Payment Gateway

Users can be redirected to handle the payment process in a simple manner, similar to their interaction with traditional payment gateways. The Payment Gateway (PG) always utilizes the latest version of the Payments API and has a neutral design.
For the sake of simplicity, we shall assume that the payment gateway base URL is https://paymentgw.com/
The payment gateway can be used for both payments and for withdrawals of funds, and both for crypto and fiat. Since flows differ slightly, details are provided separately below.
For flows involving the Onboarding wallet, extra parameters are available to further facilitate UX. More information here.

Payments with Crypto

Payments in crypto are specified by including the /payment/crypto string in the redirect. Below we specify the rest of the mandatory and optional parameters.

Mandatory parameters

  • web3Address: the public web3 address that will be required to sign the transaction. This parameter is case sensitive, and needs to be provided in checksum format.
  • buynowId: identifier of the purchase.
  • redirectUrl64: url where the user will be redirected after leaving the PG. It must be encoded in Base64.

Optional parameters

Aimed at enhancing the user experience, the following parameters can also be added using standard URL query string syntax:
  • ?l={lang}: sets the default language of the payment gateway. Supported languages: English (US) en, and Spanish (Spain) es.
  • ?wallet={wallet}: preselects the wallet that will be used to sign the transaction. Supported values: metaMask, walletConnect, and onboardingWallet.
The following summarizes how to build the URL with the parameters described so far:
https://paymentgw.com/payment/crypto/:web3Address/:buynowId/:redirectUrl64?l={lang}&wallet={wallet}

Payments with Fiat

Payments in fiat are specified by including the /payment/fiat string in the redirect. Below we specify the rest of mandatory and optional parameters.

Mandatory parameters

  • web3Address: the public web3 address that will be required to sign the transaction. This parameter is case sensitive, and needs to be provided in checksum format.
  • buynowId: identifier of the purchase.
  • redirectUrl64: url where the user will be redirected after leaving the PG. It must be encoded in Base64.

Optional parameters

Aimed at enhancing the user experience, the following parameters can also be added using standard URL query string syntax:
  • ?l={lang}: sets the default language of the payment gateway. Supported languages: English (US) en, and Spanish (Spain) es.
  • ?wallet={wallet}: preselects the wallet that will be used to sign the transaction. Supported values: metaMask, walletConnect, and onboardingWallet.
The following summarizes how to build the URL with the parameters described so far:
https://paymentgw.com/payment/fiat/:web3Address/:buynowId/:redirectUrl64?l={lang}&wallet={wallet}

Withdrawals with Crypto

Withdrawals in crypto are specified by including the /withdraw/crypto string in the redirect. Below we specify the rest of the mandatory and optional parameters.

Mandatory parameters

  • web3Address: the public web3 address that will be required to sign the transaction. This parameter is case sensitive, and needs to be provided in checksum format.
  • redirectUrl64: url where the user will be redirected after leaving the PG. It must be encoded in Base64.

Optional parameters

Aimed at enhancing the user experience, the following parameters can also be added using standard URL query string syntax:
  • ?l={lang}: sets the default language of the payment gateway. Supported languages: English (US) en, and Spanish (Spain) es.
  • ?wallet={wallet}: preselects the wallet that will be used to sign the transaction. Supported values: metaMask, walletConnect, and onboardingWallet.
  • ?buyNowId={id}: used to display withdrawal options for one single traded asset. If not specified, all pending withdrawals in crypto will be displayed to the user, as shown in the following screenshot:
Select withdraw
The following summarizes how to build the URL with the parameters described so far:
https://paymentgw.com/withdraw/crypto/:web3Address/:redirectUrl64?l={lang}&wallet={wallet}&buyNowId={id}

Withdrawals with Fiat

Withdrawals in fiat are specified by including the /withdraw/fiat string in the redirect. Below we specify the rest of the mandatory and optional parameters.

Mandatory parameters

  • web3Address: the public web3 address that will be required to sign the transaction. This parameter is case sensitive, and needs to be provided in checksum format.
  • redirectUrl64: url where the user will be redirected after leaving the PG. It must be encoded in Base64.

Optional parameters

Aimed at enhancing the user experience, the following parameters can also be added using standard URL query string syntax:
  • ?l={lang}: sets the default language of the payment gateway. Supported languages: English (US) en, and Spanish (Spain) es.
  • ?wallet={wallet}: preselects the wallet that will be used to sign the transaction. Supported values: metaMask, walletConnect, and onboardingWallet.
The Gateway for fiat withdrawals always displays all the balances available for withdrawal. Therefore, the field buyNowId is not needed as a query parameter when building the URL.
The following summarizes how to build the URL with the parameters described so far:
https://paymentgw.com/withdraw/fiat/:web3Address/:redirectUrl64?l={lang}&wallet={wallet}

Base64 encoding example

The following Javascript code snippet illustrates a simple conversion to Base64, ready to be used as redirectUrl64 parameter in the queries described above.
freeverse.io