Request a Payment

Use Payment Links or the Swapped Commerce API to create orders

Merchants can create a payment link using the Swapped dashboard or API.

From your account, navigate to the Payment Links section. Once there, click the "Create Payment Link" button in the top right. Then simply fill out the information for the payment:

  • Name: The payment title that will be visible to customers using the payment link.

  • Internal Note (Notes): This field will not be visible to end-customers, and can be used as an internal note for any purpose.

  • Image (Optional): An image/icon that will be visible to customers using the payment link, and when receiving payment completed emails.

  • Currency: The fiat currency to be displayed on the payment link

    • Note: You can select any fiat currency when creating a payment link; however, your Swapped Commerce account will only denominate in 1 base fiat currency. For example, you can create payment links in 20+ currencies, but you'll only be able to settle and withdraw 1 single fiat currency.

  • Amount: The amount of fiat currency to charge a customer.

Request a Payment via API

If you have your customers name and/or email, input it to the metadata.userName and metadata.userEmail so your customer can skip entering this in the payment widget.

Note: the testMode parameter can be input to mock a production payment.

Create an order

post

Create a payment order

Authorizations
Body
testModebooleanOptionalDefault: false
Responses
200

Successful

*/*
post
/v1/orders
POST /v1/orders HTTP/1.1
Host: pay-api.swapped.com
X-API-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 277

{
  "purchase": {
    "name": "text",
    "description": "text",
    "notes": "text",
    "imageUrl": "text",
    "price": "text",
    "currency": "USD"
  },
  "metadata": {
    "externalId": "text",
    "userId": "text",
    "userCountry": "text",
    "userName": "text",
    "userLang": "text",
    "userEmail": "text",
    "redirectUrl": "text"
  },
  "testMode": false
}
200

Successful

{
  "data": {
    "order": {
      "id": "text",
      "externalId": "text",
      "link": "text",
      "userId": "text",
      "merchant": {
        "id": "text"
      },
      "quote": {
        "fromAmount": {
          "amount": "text",
          "currency": {
            "id": "text",
            "symbol": "text",
            "precision": 1,
            "type": "FIAT",
            "flows": [
              "PAYMENT"
            ],
            "blockchain": {
              "id": "text",
              "name": "text"
            }
          }
        },
        "toAmount": {
          "amount": "text",
          "currency": {
            "id": "text",
            "symbol": "text",
            "precision": 1,
            "type": "FIAT",
            "flows": [
              "PAYMENT"
            ],
            "blockchain": {
              "id": "text",
              "name": "text"
            }
          }
        },
        "exchangeRateSnapshotId": "text",
        "fees": [
          {
            "id": "text",
            "type": "text",
            "label": "text",
            "amount": "text",
            "currency": {
              "id": "text",
              "symbol": "text",
              "precision": 1,
              "type": "text"
            },
            "createdAt": "text"
          }
        ]
      },
      "depositAddress": {
        "id": "text",
        "address": "text",
        "available": true,
        "memo": "text",
        "supportedCurrencies": [
          {
            "name": "text",
            "officialId": "text",
            "type": "FIAT",
            "symbol": "text",
            "precision": 1,
            "flows": [
              "PAYMENT"
            ],
            "blockchain": {
              "id": "text",
              "name": "text"
            },
            "blockchainId": "text",
            "isStablecoin": true,
            "decimals": 1,
            "isNative": true,
            "id": "text"
          }
        ]
      },
      "initType": "STANDARD",
      "emailReceiptSent": true,
      "emailReceiptSentAt": "text",
      "createdAt": "text",
      "expiresAt": "text",
      "status": "PENDING_USER_CREATION",
      "test": false,
      "purchase": {
        "id": "text",
        "name": "text",
        "notes": "text",
        "imageUrl": "text",
        "price": "text",
        "currency": {
          "name": "text",
          "officialId": "text",
          "type": "FIAT",
          "symbol": "text",
          "precision": 1,
          "flows": [
            "PAYMENT"
          ],
          "blockchain": {
            "id": "text",
            "name": "text"
          },
          "blockchainId": "text",
          "isStablecoin": true,
          "decimals": 1,
          "isNative": true,
          "id": "text"
        },
        "rateMerchantOverOrder": "text"
      },
      "payments": [
        {
          "id": "text",
          "orderId": "text",
          "receivedAmount": "text",
          "receivedCurrency": {
            "name": "text",
            "officialId": "text",
            "type": "FIAT",
            "symbol": "text",
            "precision": 1,
            "flows": [
              "PAYMENT"
            ],
            "blockchain": {
              "id": "text",
              "name": "text"
            },
            "blockchainId": "text",
            "isStablecoin": true,
            "decimals": 1,
            "isNative": true,
            "id": "text"
          },
          "txHash": "text",
          "confirmedAt": "text",
          "status": "text",
          "createdAt": "text",
          "depositAddress": {
            "id": "text",
            "address": "text",
            "available": true,
            "memo": "text",
            "supportedCurrencies": [
              {
                "name": "text",
                "officialId": "text",
                "type": "FIAT",
                "symbol": "text",
                "precision": 1,
                "flows": [
                  "PAYMENT"
                ],
                "blockchain": {
                  "id": "text",
                  "name": "text"
                },
                "blockchainId": "text",
                "isStablecoin": true,
                "decimals": 1,
                "isNative": true,
                "id": "text"
              }
            ]
          },
          "sourceAddress": "text",
          "fireblocksTxId": "text"
        }
      ],
      "paymentRoute": {
        "id": "text",
        "externalId": "text",
        "address": "text",
        "memo": "text"
      },
      "updates": [
        {
          "id": "text",
          "message": "text",
          "entityType": "text",
          "authorId": "text",
          "metadata": {},
          "timestamp": "text"
        }
      ],
      "metadata": {
        "externalId": "text",
        "userId": "text",
        "userName": "text",
        "userLang": "text",
        "userCountry": "text",
        "userEmail": "text",
        "redirectUrl": "text"
      },
      "settlements": [
        {
          "id": "text",
          "type": "text",
          "status": "text"
        }
      ],
      "fees": [
        {
          "id": "text",
          "label": "text",
          "type": "SWAPPED_COLLECT",
          "amount": "text",
          "currency": {
            "id": "text",
            "symbol": "text",
            "precision": 1,
            "type": "FIAT",
            "flows": [
              "PAYMENT"
            ],
            "blockchain": {
              "id": "text",
              "name": "text"
            }
          },
          "needsCollection": true,
          "createdAt": "text"
        }
      ]
    }
  },
  "message": "text",
  "success": true
}

Use this endpoint to initiate a crypto payment request. If successful, a unique paymentUrl is returned in the response; this can be embedded in an iframe or used as a redirect link.

Pass metadata.userName and metadata.userEmail to allow users to bypass the step of entering this information during the payment flow.

If a redirectUrl is included in your request, the end-customer will be automatically redirected back to your site after their payment is confirmed on-chain.

Customers will also have the option to return early via a provided button on the payment screen.

POST /api/orders

Response

{
  url: "https://pay.swapped.com/1112222
}

Last updated