Integrate with Spreedly for White Label Card Processing

Spreedly + Wyre Integration

Partners can utilize Spreedly to tokenize card details and pass it to Wyre's Card processing APIs in a PCI Compliant manner.

Creating a Payment Method in Spreedly

Create a credit card on spreedly

{
  "payment_method": {
    "credit_card": {
      "first_name": "Joe",
      "last_name": "Jones",
      "number": "5555555555554444",
      "verification_value": "423",
      "month": "3",
      "year": "2032",
      "company": "Acme Inc.",
      "address1": "33 Lane Road",
      "address2": "Apartment 4",
      "city": "Wanaque",
      "state": "NJ",
      "zip": "31331",
      "country": "US",
      "phone_number": "919.331.3313",
      "shipping_address1": "33 Lane Road",
      "shipping_address2": "Apartment 4",
      "shipping_city": "Wanaque",
      "shipping_state": "NJ",
      "shipping_zip": "31331",
      "shipping_country": "US",
      "shipping_phone_number": "919.331.3313"
    },
    "email": "[email protected]"
  }
}

Verify the payment method via spreedly

{
  "transaction": {
    "payment_method_token": "56wyNnSmuA6CWYP7w0MiYCVIbW6",
    "retain_on_success": true
  }
}

Executing Wyre Order

When executing a Wyre wallet order, we need Spreedly to append the raw debit card values to the wallet order request body.

const userDebitCard: IWyreDebitCard = {
     number: "{{ credit_card_number }}",
     year: "{{ credit_card_year }}",
     month: "{{#format_date}}%m,{{ credit_card_expiration_date }}{{/format_date}}",
     cvv: "{{ credit_card_verification_value }}"
};
const buyRequest: IDebitCardTransferRequest = {
     amount: amount.toString(),
     sourceCurrency: "USD",
     destCurrency: crypto.toUpperCase(),
     dest: SrnUtil.accountSrn(this.user.wyreInfo.accountId),
     givenName: this.user.firstName,
     familyName: this.user.lastName,
     phone: StringUtil.formatPhoneNumberE164(this.user.phoneNumber),
     email: this.user.email,
     address: userAddress,
     referrerAccountId: Environment.wyre.accountId,
     reservationId: walletOrder.reservation,
     debitCard: userDebitCard,
};

The next step would be to deliver the above buyRequest wallet order object to Spreedly using the deliver endpoint.

Spreedly will automatically populate the raw debit card values within the {{ var_name }} properties in the code snippet above. This will submit a wallet order request with debit card information automatically populated.

public async deliverToReceiver(buyRequest: IDebitCardTransferRequest) {
   const url = Environment.isProduction ?
                 "https://api.sendwyre.com/v3/debitcard/process/partner" :
                 "https://api.testwyre.com/v3/debitcard/process/partner";
   const requestBody = {
     delivery: {
       payment_method_token: this.user.debitCardInfo.primaryPaymentMethodToken,
       url,
       headers: `Content-Type: application/json\nAuthorization: Bearer ${Environment.wyre.apiSecret}`,
       body: JSON.stringify(buyRequest)
     }
   };
 
   const delivery = await spreedly.receivers.deliver(Environment.spreedly.wyreToken, requestBody);
   return delivery;
 }

🚧

Before integrating

Wyre partners need to ask Spreedly to whitelist https://api.sendwyre.com/* and https://api.testwyre.com/* in order to make requests to Wyre’s endpoints.