Skip to main content

Execute Card Purchase

This endpoint allows purchasing cryptocurrency (USDC or USDT) using a credit card.

Purchase Process​

When executing a card purchase, the user will be redirected to a cashier page to complete the payment, similar to the card verification process.

Technical Details​

  • Supported Coins: USDC, USDT
  • Currency: USD
  • Webhooks: This operation triggers the card_transaction_created and card_transaction_status_updated webhooks.
Authorization:

bearer

HTTP: bearer

HTTP Authorization Scheme: bearer

Headers:
Authorization: APIKey {YOUR_API_KEY}

Endpoint

POST

/api/v2/cards/purchase

Request Body Sample (Using Saved Card)​

{
"accountId": "00000000-0000-0000-0000-000000000000",
"amount": 100.00,
"currency": "USD",
"coin": "USDC",
"cardId": "11111111-1111-1111-1111-111111111111",
"paymentRedirectUrl": "https://myapp.com/payment/callback"
}

Request Body Sample (Using New Card)​

{
"accountId": "00000000-0000-0000-0000-000000000000",
"amount": 100.00,
"currency": "USD",
"coin": "USDC",
"card": {
"cardNumber": "4111111111111111",
"cardHolderName": "John Wick",
"expMonth": 12,
"expYear": 2028,
"cvv": "123",
"billingAddress": {
"address1": "123 Main St",
"address2": "Apt 4B",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "US"
},
"saveCard": true
},
"paymentRedirectUrl": "https://myapp.com/payment/callback"
}

Request Body Schema​

FieldTypeDescription
accountIdstring (uuid)Required. The account ID for the purchase.
amountnumberRequired. Amount in fiat currency to charge to the card. Minimum: $10.00. Example: 100.00.
currencystringRequired. Fiat currency. Currently only USD is supported.
coinstringRequired. Cryptocurrency to purchase. Possible values: USDC, USDT.
cardIdstring (uuid)Required if card not provided. The saved card ID to use. Card must have active status.
cardobjectRequired if cardId not provided. Card details for one-time or new card payment. See Card Object schema below.
paymentRedirectUrlstring (url)Optional. URL where the user will be redirected after completing the payment. A status query parameter will be appended.

Card Object Schema​

FieldTypeDescription
cardNumberstringRequired. Card number (13-19 digits).
cardHolderNamestringRequired. Cardholder name as it appears on the card.
expMonthintRequired. Expiry month (1-12).
expYearintRequired. Expiry year (4 digits, e.g., 2028).
cvvstringRequired. CVV/CVC code (3-4 digits).
billingAddressobjectRequired. Billing address object with address1, address2, city, state, postalCode, country.
saveCardbooleanOptional. If true, saves the card for future use. Default: false.

Response Sample​

{
"transactionId": "00000000-0000-0000-0000-000000000000",
"status": "pending",
"cashierUrl": "https://cashier.blockwyre.com/transaction/pay/xyz789abc123"
}

Response Schema​

FieldTypeDescription
transactionIdstring (uuid)Unique identifier for the transaction.
statusstringTransaction status. Initially pending.
cashierUrlstring (url)URL where the user must complete the payment process. The user will be redirected to paymentRedirectUrl after completion.

Purchase Flow​

After executing a card purchase, the user must complete the payment process:

  1. API Response: Returns cashierUrl where the user must complete the payment.
  2. User Action: User is redirected to cashierUrl to complete payment (e.g., 3D Secure, additional authentication).
  3. Payment Processing: The card is charged for the amount.
  4. Fee Deduction: Processing and network fees are deducted from the amount.
  5. Completion: After payment, user is redirected to paymentRedirectUrl (if provided) with a status query parameter.
  6. Crypto Delivery: If successful, the cryptocurrency (after fees) is credited to the user's wallet.

Example Flow​

User requests: amount = $100.00, coin = USDC

Card is charged: $100.00
Fees deducted: $2.50 (processing + network)
Crypto delivered: 97.50 USDC

Payment Redirect Status​

When the user completes the payment process, they will be redirected to the paymentRedirectUrl with a status query parameter appended.

Redirect URL Format​

{paymentRedirectUrl}?status={status_value}

Example:

https://myapp.com/payment/callback?status=captured

Status Values​

StatusDescription
authorisedCard was successfully authorized. Order will complete once captured (within minutes).
refusedCard was refused/declined by card issuer.
failedFailed attempt. Please try again or contact support.
capturedCard was successfully captured. Order will proceed.
cancelledPayment was cancelled. Order will reverse.
refundedPayment was refunded.

Saving a Card for Future Use​

To save a card for future purchases, include "saveCard": true in the card object. After a successful transaction, the card will be saved and can be used in future purchases by referencing its cardId.

How to save a card:

  1. Make a purchase using the card object with saveCard: true
  2. After successful payment, the card is saved with active status
  3. Use the List Credit Cards endpoint to retrieve the saved card's cardId
  4. For future purchases, use cardId instead of providing full card details

Prerequisites​

  • If using cardId: Card must have active status and belong to the specified account.
  • Account must have approved verification status.

Support and Resources​

If you need assistance or have any questions, our support team is here to help. You can contact our support team at support@blockwyre.com.

Stay Updated​

Stay up-to-date with the latest news, updates, and features from BlockWyre by following us on social media:

We are excited to have you on board and look forward to seeing how you leverage BlockWyre's powerful tools to enhance your financial operations. Happy integrating!