Skip to main content
On this page

Prerequisites#

Before implementing Astropay, ensure you have:

  1. Enabled Astropay in the DEUNA Admin Panel
  2. A generated order token.
  3. Integrated the DEUNA SDK in your project.
  4. Reviewed the Payment Widget documentation for your platform.

Payment Method configuration#

Display the Payment Widget by passing the Astropay configuration in the paymentMethods parameter.

JSON
[
    {
    "paymentMethod": "wallet",
    "processors": ["astropay"]
    }
]

Payment Widget - Web#

JavaScript
DeunaSDK.initPaymentWidget({
  orderToken: 'YOUR_ORDER_TOKEN',
  paymentMethods: [
    {
      paymentMethod: 'wallet',
      processors: ['astropay'],
    },
  ],
  callbacks: { ... },
});

Payment Widget - Android#

Modal (PageSheet)Swift
// MODAL
deunaSDK.initPaymentWidget(
    context = context,
    orderToken = orderToken,
    callbacks = PaymentWidgetCallbacks().apply { ... },
    paymentMethods = listOf(
        mapOf(
            "paymentMethod" to "wallet",
            "processors" to listOf("astropay")
        )
    )
)

/// EMBEDDED
PaymentWidgetConfiguration(
    orderToken = orderToken,
    paymentMethods = listOf(
        mapOf(
            "paymentMethod" to "wallet",
            "processors" to listOf("astropay")
        )
    ),
    callbacks = PaymentWidgetCallbacks().apply { ... },
    sdkInstance = deunaSDK
)

Payment Widget - iOS#

Swift
/// MODAL
deunaSDK.initPaymentWidget(
 orderToken: "<DEUNA order token>",
 userToken: ..., // optional
 styleFile: ..., // optional
 callbacks: ...,
 paymentMethods: [
   [ 
     "paymentMethod": "wallet",
     "processors": ["astropay"],
   ]
 ]
)

// EMBEDDED
DeunaWidget(
  deunaSDK: deunaSDK,
  configuration: PaymentWidgetConfiguration(
    orderToken: "YOUR_ORDER_TOKEN",
    callbacks: PaymentWidgetCallbacks(
      onSuccess: { order in },
      onError: { error in },
      onEventDispatch: { event, data in }
    ),
     paymentMethods: [
       [ 
         "paymentMethod": "wallet",
         "processors": ["astropay"]
       ]
     ]
  )
)

Payment Widget - React Native#

JavaScript
/// MODAL
DeunaSDK.initPaymentWidget({
  orderToken: 'YOUR_ORDER_TOKEN',
  paymentMethods: [
    {
      paymentMethod: 'wallet',
      processors: ['astropay'],
    },
  ],
  callbacks: { ... },
});