Spreedly for White Label Card Processing

Spreedly x Wyre Integration

Spreedly works as a gateway to multiple payment platforms allowing developers to create a credit card cloud that works across different services. With the Spreedly integration with Wyre, we combine forces and bring you the power of an interconnected payment system. This means partners can utilize Spreedly to tokenize card details and pass it to Wyre's Card Processing APIs in a PCI Compliant manner.

See Spreedly docs on ‘payment method designation'. The high level steps are - Create your Wyre receiver, integrate Spreedly to your site or app, use Spreedly deliver endpoint to pass card information to Wyre. After this step, the process is the same for all white label card processing partners.

Create a Wyre Receiver Token for Your Environment

A Spreedly production account is required to setup Wyre as a payment method receiver. You can use your environment keys for the basic authentication.

Request
POST /v1/receivers.json HTTP/1.1
Host: http://core.spreedly.com/
Content-Type: application/json
Authorization: Basic

{
     "receiver": {
          "receiver_type": "send_wyre",
          "hostnames": "https://api.testwyre.com"
     }
}

Response

{
"receiver": {
"company_name": "SendWyre",
"receiver_type": "send_wyre",
"token": "RECEIVER_TOKEN_HERE",
"hostnames": "https://api.sendwyre.com, https://api.testwyre.com",
"sub_merchant_key": null,
"state": "retained",
"created_at": "2022-03-29T04:26:55Z",
"updated_at": "2022-03-29T04:26:55Z",
"credentials": null,
"ssl_certificate_token": null
}
}

Use Spreedly Express for PCI-Compliant Payment Method

Adding Payment Methods using Spreedly Express
Add the express widget to your webpage to collect card information

<script src="https://core.spreedly.com/iframe/express-3.min.js" id="express-script"></script>
<script type="text/javascript">
var environmentKey = "YOUR_ENVIRONMENT_KEY_HERE"
var options = {
company_name: "Spreedly/Wyre",
sidebar_top_description: "This is where you can buy all your food and most of your stuff",
sidebar_bottom_description: "destAmount",
amount: "TBD"}

var enableButton = function(){
document.getElementById("ready-to-pay").disabled = false;
document.getElementById("ready-to-pay").addEventListener("click", function(){
SpreedlyExpress.setDisplayOptions({
sidebar_bottom_description: "Get some " + document.getElementById('currencySelect').value,
amount: "$" + document.getElementById('usd').value
});
SpreedlyExpress.openView();})

}
SpreedlyExpress.onInit(enableButton);

var handlePaymentToken = function(token, formData) {
var tokenField = document.getElementById('paymentToken');
tokenField.setAttribute("value", token);
var quoteForm = document.getElementById('quoteForm');
quoteForm.requestSubmit();
}
SpreedlyExpress.onPaymentMethod(handlePaymentToken);

SpreedlyExpress.init(environmentKey,options);
</script>

After you enter data into the widget, keep the token as the “payment_method_token”

Note
This payment method will expire after 5-10 minutes. Also, the CVV for a payment method will expire after the first authorize, purchase, or verify that you run against the card.

Executing Wyre Order

Before starting out, 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.

Create a wallet order reservation that will be used to process the order.

We will deliver the buyRequest through Spreedly using the deliver endpoint. Spreedly will automatically populate the raw debit card values within the {{ var_name }} properties in the request body. This will submit a wallet order request with debit card information automatically populated. These values are generated from the provided payment_method_token field, which was created in the previous step.

Request
POST /v1/receivers/RECEIVER_TOKEN_HERE/deliver.json HTTP/1.1
Host: core.spreedly.com
Content-Type: application/json
Authorization: Basic

{
    "delivery": {
        "payment_method_token": "PAYMENTMETHODTOKEN",
        "url": "https://api.testwyre.com/v3/debitcard/process/partner", 
        "headers": "Content-Type: application/json\r\nAuthorization: Bearer WYRE_API_KEY_HERE",
        "body":"{\n \"amount\": \"10\",\n  \"sourceCurrency\": \"USD\",\n  \"destCurrency\": \"BTC\",\n  \"dest\": \"bitcoin:muTfSGzKUBJe3GXT6NefXEJRrBfq59wQic\",\n  \"givenName\": \"Joe\",\n  \"familyName\": \"Jones\",\n \"phone\": \"919.331.3313\",\n  \"email\": \"[email protected]\",\n  \"address\": { \"street1\": \"33 Lane Road\",\n  \"city\": \"Wanaque\",\n  \"state\": \"NJ\",\n  \"postalCode\": \"31331\",\n  \"country\": \"US\"},\n  \"debitCard\": { \"number\": \"{{credit_card_number}}\",\n  \"year\": \"{{credit_card_year}}\",\n  \"month\": \"{{credit_card_month}}\",\n  \"cvv\": \"{{credit_card_verification_value}}\"},\n  \"reservationId\": \"RESERVATION_ID_HERE\",\n  \"referrerAccountId\": \"AC_YOUR_ACCOUNT_ID\",\n  \"referenceId\": \"AC_YOUR_ACCOUNT_ID\",\n  \"ipAddress\": \"1.1.1.1\"}"
    }
}

Response
You can find Wyre’s response within the Spreedly call response at response.data.transaction.response.body

{"id":"WO_LBZWDFHTGQ","createdAt":1648597940463,"owner":"account:AC_UVR8MRR2B3Y","status":"RUNNING_CHECKS","orderType":"DOMESTIC","sourceAmount":25.00,"purchaseAmount":20.00,"sourceCurrency":"USD","destCurrency":"BTC","transferId":null,"dest":"bitcoin:muTfSGzKUBJe3GXT6NefXEJRrBfq59wQic","authCodesRequested":false,"blockchainNetworkTx":null,"accountId":"AC_UVR8MRR2B3Y","paymentMethodName":null}

Using the given wallet order id, you can track the order.
You can continue following the White Label Card Processing Guide to understand the full flow.