Skip to main content

How to migrate from Spreedly

Transitioning from one payment platform to another can seem challenging, but it doesn't have to be. This recipe is designed to assist you in migrating from Spreedly to IXOPAY platform. We aim to make this transition as straightforward as possible by providing you with key insights and code samples that highlight the differences between the two platforms.

Main differences

Before we delve into the specifics, it's important to understand the main differences between Spreedly and IXOPAY platform. These differences extend beyond the features each platform offers and include how they handle transactions, notifications, and integrations. Here are some of the key distinctions:

  • IXOPAY platform sends you an asynchronous callback once a transaction reaches a final state (success or error).
  • You don't have to deal with multiple formats from various payment processors behind Spreedly, everything is already transformed to the IXOPAY platform notification format.
  • IXOPAY platform supports custom styled payment forms, Javascript integration via payment.js or redirect integration, for example for PayPal, Sofort, iDeal etc.

Javascript integration

Javascript include

<script src="https://core.spreedly.com/iframe/iframe-v1.min.js"></script>

Initializing & styling

Spreedly.init("ENV_KEY", {
numberEl: "div-id-of-cc-number",
cvvEl: "div-id-of-cvv",
});
Spreedly.on("ready", function () {
Spreedly.setStyle("number", "width:225px; height:35px;");
Spreedly.setStyle("number", "font-size: 20px; text-align: center");
Spreedly.setStyle("cvv", "width:60px; height:35px;");
});

Tokenization

Spreedly.tokenizeCreditCard({
// Required
first_name: document.getElementById("first-name").value,
last_name: document.getElementById("last-name").value,
month: document.getElementById("month").value,
year: document.getElementById("year").value,

// Optional
email: document.getElementById("email").value,
zip: document.getElementById("zip").value,
});

Spreedly.on("paymentMethod", function (token, paymentMethod) {
// Send requisite payment method info to backend
var tokenField = document.getElementById("payment_method_token");
var fingerprintField = document.getElementById("payment_method_fingerprint");

tokenField.setAttribute("value", token);
fingerprintField.setAttribute("value", paymentMethod["fingerprint"]);

var masterForm = document.getElementById("payment-form");
masterForm.submit();
});

Transaction API

Initial purchase

POST /v1/gateways/<gateway_token>/purchase.json
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json

{
"transaction": {
"payment_method_token": "56wyNnSmuA6CWYP7w0MiYCVIbW6",
"amount": 9.99,
"currency_code": "EUR",
"retain_on_success": true
}

Recurring transaction

POST /v1/gateways/<gateway_token>/purchase.json
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json

{
"transaction": {
"payment_method_token": "56wyNnSmuA6CWYP7w0MiYCVIbW6",
"amount": 9.99,
"currency_code": "EUR"
}
}