Payments for an NFT Drop

Conceptual Overview

Partners looking to do an NFT drop where users can purchase NFTs with fiat card payments, can do so utilizing Wyre's fiat card payment rails. (They can also utilize any of our supported cryptocurrencies.)

Payments will show up in the Wyre Dashboard into the partner's account balance and from there the Partner can move funds from Wyre to their bank account.

We will use Wallet Order Reservations and Create Orders to process the user's card payment.

Step 1: Create a Dashboard account

Go to Set Up Your Wyre Account to set up a Wyre Dashboard account where you'll be able to see the account balance and pay out to your bank account when needed. Through here, you'll also receive an account id which you need to reference for the API calls.

Step 2: Set Up Wallet Order Webhooks

Setting up Wallet Order webhooks are necessary to make the flow work. When a payment is completed the webhook url will be notified and then the NFT can be delivered to the buyer.

#create webhook to receive updates on payments

curl --location --request POST 'https://api.testwyre.com/v2/digitalwallet/webhook' \
--header 'Authorization: Bearer SK-86Z8FYFB-UTA2RDCN-HCZBFT2V-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{ 
"owner":"account:AC_YC3NT6GEZ8U", 
"webhook":"https://requestinspector.com/inspect/wyretest"
}'

Step 3: Creating an Order

Creating an order requires two steps:

The first step is creating a wallet order reservation.

# create a wallet order reservation to get a reservation id
curl --request POST \
     --url https://api.testwyre.com/v3/orders/reserve \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer SK-86Z8FYFB-UTA2RDCN-HCZBFT2V-xxx' \
     --header 'Content-Type: application/json'
     
     
# response
{
  "url": "https://pay.testwyre.com/purchase?accountId=AC_YC3NT6GEZ8U&reservation=G9QYE4THWRALVURF8LAV&utm_campaign=AC_YC3NT6GEZ8U&utm_medium=widget&utm_source=checkout",
  "reservation": "G9QYE4THWRALVURF8LAV"
}

The second step is to use the reservation id to do the actual card processing order where funds settle into our account.

# create order based on the reservation id
curl --request POST \
     --url https://api.testwyre.com/v3/debitcard/process/partner \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer SK-86Z8FYFB-UTA2RDCN-HCZBFT2V-xxx' \
     --header 'Content-Type: application/json' \
     --data '
{
     "debitCard": {
          "number": "4111111111111111",
          "year": "2023",
          "month": "01",
          "cvv": "123"
     },
     "address": {
          "street1": "1234 Test Ave",
          "city": "Los Angeles",
          "state": "CA",
          "postalCode": "91423",
          "country": "US"
     },
     "reservationId": "G9QYE4THWRALVURF8LAV",
     "amount": "10",
     "sourceCurrency": "USD",
     "destCurrency": "USD",
     "dest": "account:AC_YC3NT6GEZ8U ",
     "referrerAccountId": "AC_YC3NT6GEZ8U",
     "givenName": "Crash",
     "familyName": "Bandicoot",
     "email": "[email protected]",
     "ipAddress": "1.1.1.1",
     "phone": "+14158122223"
}
'
# response
{
  "id": "WO_WVZG4WC6E9",
  "createdAt": 1648796904745,
  "owner": "account:AC_CBLAE64LCTX",
  "status": "RUNNING_CHECKS",
  "orderType": "DOMESTIC",
  "sourceAmount": 15,
  "purchaseAmount": 10,
  "sourceCurrency": "USD",
  "destCurrency": "USD",
  "transferId": null,
  "dest": "account:AC_YC3NT6GEZ8U ",
  "authCodesRequested": false,
  "blockchainNetworkTx": null,
  "accountId": "AC_CBLAE64LCTX",
  "paymentMethodName": null
}

Step 4: Webhook Trigger

After the webhook triggers with orderStatus: COMPLETE you can transfer the NFT to the user's wallet.

{
    "referenceId": null,
    "accountId": "AC_JVPFPWYQH4B",
    "orderId": "WO_WVZG4WC6E9",
    "orderStatus": "COMPLETE",
    "transferId": "TF_PCZ6N9ECMUC",
    "failedReason": null,
    "error": null,
    "reservation": "G9QYE4THWRALVURF8LAV",
    "email": "[email protected]"
}

When this webhook is triggered with orderStatus COMPLETE it means that funds have safely landed in your Wyre account.

Step 5: Transfer Funds from Wyre to your Bank

Whenever you'd like, you can move funds from your Wyre account balance to the bank account associated with your Wyre Account

curl --location --request POST 'https://api.testwyre.com/v3/transfers' \
--header 'Authorization: Bearer SK-86Z8FYFB-UTA2RDCN-HCZBFT2V-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
     "source": "account:AC_YC3NT6GEZ8U",
     "sourceCurrency": "USD",
     "sourceAmount": "20000",
     "dest": "paymentmethod:PA_PHGRYETF2G4",
     "destCurrency": "USD",
     "message": "Bank Account Payout",
     "autoConfirm": true
}'


#response:
{
    "pusherChannel": "948579bd6542bed51ab1ed214d66cb82",
    "exchangeRate": null,
    "sourceCurrency": "USD",
    "destCurrency": "USD",
    "sourceAmount": 20040.00,
    "destAmount": 20000.00,
    "createdAt": 1648824964000,
    "dest": "paymentmethod:PA_PHGRYETF2G4",
    "fees": {
        "USD": 40.00
    },
    "totalFees": 40.00,
    "customId": null,
    "completedAt": null,
    "cancelledAt": null,
    "failureReason": null,
    "blockchainTx": null,
    "expiresAt": 1648825864000,
    "updatedAt": null,
    "estimatedArrival": 1648997764643,
    "reversingSubStatus": null,
    "reversalReason": null,
    "pendingSubStatus": "IN_REVIEW",
    "statusHistories": [],
    "message": "Bank Account Payout",
    "id": "TF_9MJRWPBQZ4E",
    "owner": "account:AC_YC3NT6GEZ8U",
    "source": "account:AC_YC3NT6GEZ8U",
    "status": "PENDING"
}