Alipay Payment Request

Definition: POST https://paytest.smart2pay.com/v1/payments

Below you will find a full example of a payment request for Alipay method (with Success and Bad response). The parameters of the payment are sent in the message body as a JSON object.

For Alipay payments only the following Articles parameters are mandatory to be sent in the request, the rest of them are optional:

  • Name – Article’s name;
  • Quantity – The number of products.

A 201 HTTP response (Created) is returned if the payment was correctly initialized.

For more information about status codes, please go to Basic HTTP Status Codes.

Request: 

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
  "Payment": {
    "MerchantTransactionID": "s2ptest_h31",
    "Amount": "100",
    "Currency": "CNY",      
    "MethodID": 24,
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",      
    "TokenLifetime": 10,
    "BillingAddress": {
      "Country": "CN"
      },        
    "Articles": [
      { 
      "Name": "TEST",
      "Quantity": 1
      }
    ]
  }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": 4201852,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20181120122556",
        "MerchantTransactionID": "s2ptest_h31",
        "OriginatorTransactionID": null,
        "Amount": "100",
        "Currency": "CNY",
        "CapturedAmount": null,
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": null,
        "MethodID": 24,
        "MethodOptionID": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30201,
        "NotificationDateTime": "20181120122556",
        "Customer": null,
        "BillingAddress": null,
        "ShippingAddress": null,
        "Articles": [
            {
                "MerchantArticleID": null,
                "Name": "TEST",
                "Quantity": 1,
                "Price": null,
                "VAT": null,
                "Discount": null,
                "Type": null,
                "TaxType": null,
                "DiscountValue": null
            }
        ],
        "Details": null,
        "ReferenceDetails": null,
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 1,
            "Info": "Open",
            "Reasons": null
        },
        "MethodTransactionID": null,
        "TokenLifetime": null,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": null
    }
}

In case of an API error, an HTTP 4xx (you did something wrong) or HTTP 5xx (we did something wrong) response is returned.

For more information about the reasons of a wrong request response see our section GlobalPay Return Codes.

Request:

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
  "Payment": {
    "MerchantTransactionID": "s2ptest_h32",
    "Amount": "100",
    "Currency": "CN",      
    "MethodID": 24,
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",      
    "TokenLifetime": 10,
    "BillingAddress": {
      "Country": "CN"
      },
        
    "Articles": [
      { 
      "Name": "TEST",
      "Quantity": 1
      }
    ]
  }
}

Response:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": null,
        "SkinID": null,
        "ClientIP": null,
        "Created": null,
        "MerchantTransactionID": "s2ptest_h32",
        "OriginatorTransactionID": null,
        "Amount": "100",
        "Currency": "CN",
        "CapturedAmount": null,
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": null,
        "MethodID": 24,
        "MethodOptionID": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": null,
        "NotificationDateTime": null,
        "Customer": null,
        "BillingAddress": null,
        "ShippingAddress": null,
        "Articles": null,
        "Details": null,
        "ReferenceDetails": null,
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": null,
            "Info": null,
            "Reasons": [
                {
                    "Code": "2",
                    "Info": "Validation failed - Currency (RegEx: ^[A-Z]{3}$)"
                }
            ]
        },
        "MethodTransactionID": null,
        "TokenLifetime": null,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": null
    }
}

Alipay POS Payment Request

Definition: POST https://paytest.smart2pay.com/v1/payments

Below you will find a full example of a payment request for Alipay POS method (with Success and Bad response). The parameters of the payment are sent in the message body as a JSON object.

For Alipay POS payments the following Details parameters are mandatory to be sent in the request:

  • IsOffline – Offline payment method;
  • StoreName – Store name. Can be null only when the store information is verified;
  • StoreId – Store ID;
  • TerminalID – Terminal ID.

A 201 HTTP response (Created) is returned if the payment was correctly initialized.

For more information about status codes, please go to Basic HTTP Status Codes.

Request: 

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
  "Payment": {
    "MerchantTransactionID": "s2ptest_k3",
    "Amount": 11,
    "Currency": "CNY",      
    "MethodID": 24,
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",      
    "TokenLifetime": 10,
    "Customer": {    
      "Email": "youremail@email.com"   
    },
    "BillingAddress": {
      "Country": "CN"
      },
    "Details": {    
      "IsOffline": true,
      "StoreName": "Zara Palace Mall",
      "StoreId": "ZA2345",
      "TerminalID": "T8999"
    }
  }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
  "Payment": {
    "ID": 4116562,
    "SkinID": null,
    "ClientIP": null,
    "Created": "20181009113914",
    "MerchantTransactionID": "s2ptest_k3",
    "OriginatorTransactionID": null,
    "Amount": "11",
    "Currency": "CNY",
    "CapturedAmount": null,
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",
    "Description": "",
    "MethodID": 24,
    "MethodOptionID": null,
    "IncludeMethodIDs": null,
    "ExcludeMethodIDs": null,
    "PrioritizeMethodIDs": null,
    "SiteID": 30201,
    "NotificationDateTime": null,
    "Customer": {
      "ID": 340,
      "MerchantCustomerID": null,
      "Email": "youremail@email.com",
      "FirstName": null,
      "LastName": null,
      "Gender": null,
      "SocialSecurityNumber": null,
      "SocialSecurityNumber2": null,
      "Phone": null,
      "Company": null,
      "DateOfBirth": null
      },
    "BillingAddress": {
      "ID": 291,
      "City": null,
      "ZipCode": null,
      "State": null,
      "Street": null,
      "StreetNumber": null,
      "HouseNumber": null,
      "HouseExtension": null,
      "Country": "CN"
      },
    "ShippingAddress": null,
    "Articles": null,
    "Details": null,
    "ReferenceDetails": {
      "BankCode": null,
      "BankName": null,
      "EntityID": null,
      "EntityNumber": null,
      "ReferenceID": null,
      "ReferenceNumber": null,
      "SwiftBIC": null,
      "AccountCurrency": null,
      "AccountNumber": null,
      "AccountHolder": null,
      "IBAN": null,
      "QRCodeURL": "",
      "Instructions": null
      },
    "CustomParameters": null,
    "PreapprovalID": null,
    "Status": {
      "ID": 1,
      "Info": "Open",
      "Reasons": null
      },
    "MethodTransactionID": null,
    "TokenLifetime": 10,
    "Capture": null,
    "PreapprovalDetails": null,
    "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=16D936ADDF2358BBDB4F4C1A151E3F4C.4116562"
  }
}

In case of an API error, an HTTP 4xx (you did something wrong) or HTTP 5xx (we did something wrong) response is returned.

For more information about the reasons of a wrong request response see our section GlobalPay Return Codes.

Request:

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
  "Payment": {
    "MerchantTransactionID": "s2ptest_k5",
    "Amount": 11,
    "Currency": "CNY",      
    "MethodID": 24,
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",      
    "TokenLifetime": 10,
    "Customer": {    
      "Email": "youremail@email.com"   
    },
    "BillingAddress": {
      "Country": "China"
      },
    "Details": {    
      "IsOffline": true,
      "StoreName": "Zara Palace Mall",
      "StoreId": "ZA2345",
      "TerminalID": "T8999"
    }
  }
}

Response:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8

{
  "Payment": {
    "ID": 4117087,
    "SkinID": null,
    "ClientIP": null,
    "Created": "20181009125002",
    "MerchantTransactionID": "s2ptest_k5",
    "OriginatorTransactionID": null,
    "Amount": "11",
    "Currency": "CNY",
    "CapturedAmount": null,
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",
    "Description": null,
    "MethodID": 24,
    "MethodOptionID": null,
    "IncludeMethodIDs": null,
    "ExcludeMethodIDs": null,
    "PrioritizeMethodIDs": null,
    "SiteID": 30201,
    "NotificationDateTime": "20181009125002",
    "Customer": null,
    "BillingAddress": null,
    "ShippingAddress": null,
    "Articles": null,
    "Details": null,
    "ReferenceDetails": null,
    "CustomParameters": null,
    "PreapprovalID": null,
    "Status": {
      "ID": 4,
      "Info": "Failed",
      "Reasons": [
      {
        "Code": 147,
        "Info": "Address details are invalid (BillingAddress)Country - RegEx: ^[a-zA-Z]{2}$;"
        }
      ]
    },
    "MethodTransactionID": null,
    "TokenLifetime": null,
    "Capture": null,
    "PreapprovalDetails": null,
    "RedirectURL": null
  }
}

Alipay POS Test Data

For Alipay payment method there aren’t any test data available, but you can see how it works with the payment flow given below.

Alipay POS Payment Flow

    1. The Customer selects his preferred currency from the list and continues the payment.

      1 Select currency

You can skip this step by sending in the initial POST the following parameters: SkipHPP=1 and CustomerEmail.

  1. The Customer is redirected to Alipay payment page. The Customer opens Alipay application and scans the QR code.

    1 Payment version

  2. The payment details are displayed and the customer confirms the payment.

    1 Payment confirmation

  3. Upon completion of the payment flow, the customer is redirected back to your ReturnURL.

    1 Return page when the redirection status is Processing

Bank Transfer Payment Request

Definition: POST https://paytest.smart2pay.com/v1/payments

Below you will find a full example of a payment request for Bank Transfer method (with Success and Bad response). The parameters of the payment are sent in the message body as a JSON object.

In order to display the bank transfer details to your customers on your own page, you can send in the request the CustomerName and Country parameters. Use the information received in Response in the ReferenceDetails object.

A 201 HTTP response (Created) is returned if the payment was correctly initialized.

For more information about status codes, please go to Basic HTTP Status Codes.

Request: 

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
  "Payment":{
    "MerchantTransactionID": "s2ptest_h35",
    "Amount": 400,
    "Currency": "PLN",
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",
    "Description": "BankTransferTestdetails",
    "MethodID": "1",
    "BillingAddress": {
      "Country": "DE"
    },
    "Customer": {
      "FirstName": "John",
      "LastName": "Doe"
    }
  }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": 4178425,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20181107093433",
        "MerchantTransactionID": "s2ptest_h35",
        "OriginatorTransactionID": null,
        "Amount": "400",
        "Currency": "PLN",
        "CapturedAmount": null,
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": "BankTransferTestdetails",
        "MethodID": 1,
        "MethodOptionID": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30201,
        "NotificationDateTime": null,
        "Customer": {
            "ID": 142823,
            "MerchantCustomerID": null,
            "Email": null,
            "FirstName": "John",
            "LastName": "Doe",
            "Gender": null,
            "SocialSecurityNumber": null,
            "SocialSecurityNumber2": null,
            "Phone": null,
            "Company": null,
            "DateOfBirth": null
        },
        "BillingAddress": {
            "ID": 420,
            "City": null,
            "ZipCode": null,
            "State": null,
            "Street": null,
            "StreetNumber": null,
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "DE"
        },
        "ShippingAddress": null,
        "Articles": null,
        "Details": null,
        "ReferenceDetails": {
            "BankCode": null,
            "BankName": "ING Bank",
            "EntityID": null,
            "EntityNumber": null,
            "ReferenceID": null,
            "ReferenceNumber": "HPP4178425",
            "SwiftBIC": "INGBDEFF",
            "AccountCurrency": "EUR",
            "AccountNumber": "0010126423",
            "AccountHolder": "Stichting Smart2Pay Escrow Services",
            "IBAN": "DE72 5002 1000 0010 1264 23",
            "AmountToPay": "0.93 EUR",
            "QRCodeURL": null,
            "Instructions": null
        },
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 1,
            "Info": "Open",
            "Reasons": null
        },
        "MethodTransactionID": null,
        "TokenLifetime": 1,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=F152AF870FFF05B98A83F7B8C35A81D9.4178425"
    }
}

There is another possibility to initiate a Bank Transfer transaction where you can send your own Reference Number in the request. Checkout the below example with the ReferenceNumber parameter sent in the request together with Customer parameters:

Request:

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
  "Payment": {
    "MerchantTransactionID": "s2ptest_h39",
    "Amount": 400,
    "Currency": "PLN",
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",
    "Description": "BankTransferTestdetails",
    "MethodID": "1",
    "BillingAddress": {
      "Country": "DE"
    },
    "Customer": {
      "FirstName": "John",
      "LastName": "Doe"
    },
    "Details": {
      "ReferenceNumber": "your_reference_number"
    }
  }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": 4178441,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20181107095318",
        "MerchantTransactionID": "s2ptest_h39",
        "OriginatorTransactionID": null,
        "Amount": "400",
        "Currency": "PLN",
        "CapturedAmount": null,
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": "BankTransferTestdetails",
        "MethodID": 1,
        "MethodOptionID": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30201,
        "NotificationDateTime": null,
        "Customer": {
            "ID": 142823,
            "MerchantCustomerID": null,
            "Email": null,
            "FirstName": "John",
            "LastName": "Doe",
            "Gender": null,
            "SocialSecurityNumber": null,
            "SocialSecurityNumber2": null,
            "Phone": null,
            "Company": null,
            "DateOfBirth": null
        },
        "BillingAddress": {
            "ID": 420,
            "City": null,
            "ZipCode": null,
            "State": null,
            "Street": null,
            "StreetNumber": null,
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "DE"
        },
        "ShippingAddress": null,
        "Articles": null,
        "Details": {
            "AccountNumber": null,
            "AccountHolder": null,
            "IBAN": null,
            "BIC": null,
            "PrepaidCard": null,
            "PrepaidCardPIN": null,
            "SerialNumbers": null,
            "Wallet": null,
            "ReferenceNumber": null,
            "PayerCountry": null,
            "PayerEmail": null,
            "PayerPhone": null,
            "BankCode": null,
            "BankName": null,
            "BankSortCode": null,
            "SocialSecurityNumber": null,
            "BillingCycleStart": null,
            "BillingCycleEnd": null,
            "UnsubscribeInstructions": null,
            "CustomerLoginID": null,
            "PaidAmount": null,
            "PaidCurrency": null,
            "ProviderExchangeRate": 0,
            "PayerBankAccountID": null
        },
        "ReferenceDetails": {
            "BankCode": null,
            "BankName": "ING Bank",
            "EntityID": null,
            "EntityNumber": null,
            "ReferenceID": null,
            "ReferenceNumber": "your_reference_number",
            "SwiftBIC": "INGBDEFF",
            "AccountCurrency": "EUR",
            "AccountNumber": "0010126423",
            "AccountHolder": "Stichting Smart2Pay Escrow Services",
            "IBAN": "DE72 5002 1000 0010 1264 23",
            "AmountToPay": "0.93 EUR",
            "QRCodeURL": null,
            "Instructions": null
        },
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 1,
            "Info": "Open",
            "Reasons": null
        },
        "MethodTransactionID": null,
        "TokenLifetime": 1,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=DDC981EDC0426B8C22F57F88FD8B0FF4.4178441"
    }
}

In case of an API error, an HTTP 4xx (you did something wrong) or HTTP 5xx (we did something wrong) response is returned.

For more information about the reasons of a wrong request response see our section GlobalPay Return Codes.

Request:

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
  "Payment": {
    "MerchantTransactionID": "s2ptest_h36",
    "Amount": 400,
    "Currency": "PLN",
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",
    "Description": "BankTransferTestdetails",
    "MethodID": "1",
    "BillingAddress": {
      "Country": "Germany"
    },
    "Customer": {
      "FirstName": "John",
      "LastName": "Doe"
    }
  }
}

Response:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": 4178427,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20181107094050",
        "MerchantTransactionID": "s2ptest_h36",
        "OriginatorTransactionID": null,
        "Amount": "400",
        "Currency": "PLN",
        "CapturedAmount": null,
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": "BankTransferTestdetails",
        "MethodID": 1,
        "MethodOptionID": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30201,
        "NotificationDateTime": "20181107094050",
        "Customer": null,
        "BillingAddress": null,
        "ShippingAddress": null,
        "Articles": null,
        "Details": null,
        "ReferenceDetails": null,
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 4,
            "Info": "Failed",
            "Reasons": [
                {
                    "Code": "147",
                    "Info": "Address details are invalid (BillingAddress)Country - RegEx: ^[a-zA-Z]{2}$;"
                }
            ]
        },
        "MethodTransactionID": null,
        "TokenLifetime": null,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": null
    }
}

Cards Russia Refund Request (Fiscalization)

This setup is required for the Merchants that decide to setup the interaction with their online sales register via Yandex.Checkout.

For Cards Russia the refunds can be full and/or partial depending if you have to return all the money to customer or not. A particular case is for Partial refund as you will need to provide additional parameters.

Below there are two examples of a refund request: one for a full refund, where no additional parameters are needed and one for a partial refund, where additional parameters are needed.

Definition: POST /v1/payments/{id}/refunds

Where:
  • {id} – GlobalPay Payment ID

A 201 HTTP response (Created) is returned if the refund was correctly initialized.

Full refund means you can only refund the entire paid amount for the initial transaction. For full refund you only need to send the Amount parameter, like in the below example:

Request:

POST https://paytest.smart2pay.com/v1/payments/300538912/refunds
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
  "Refund": {
    "MerchantTransactionID": "s2ptest_g28_a",
    "Amount": 100
   }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
  "Refund": {
    "ID": 16405,
    "Created": "20170803095139",
    "MerchantTransactionID": "s2ptest_g28_a",
    "OriginatorTransactionID": null,
    "InitialPaymentID": 300538912,
    "Amount": "100",
    "Currency": "EUR",
    "Description": null,
    "TypeID": 5,
    "SiteID": 30201,
    "Details": null,
    "Customer": null,
    "BillingAddress": null,
    "BankAddress": null,
    "Articles": null,
    "Status": {
      "ID": 1,
      "Info": "Open",
      "Reasons": null
    }
  }
}

For Cards Russia a particular case is for Partial refund as you will need to provide the below additional parameters in request: Merchant Article ID and Quantity, like in the below example:

Request:

POST https://paytest.smart2pay.com/v1/payments/3006154/refunds
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
  "Refund": {
    "MerchantTransactionID": "YandexPartialRefund",
    "Amount": 980,
    "Articles": [
      {
        "MerchantArticleID": "1231",
        "Quantity": 1
      }
    ]
  }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
  "Refund": {
    "ID": 0,
    "Created": null,
    "MerchantTransactionID": "YandexPartialRefund",
    "OriginatorTransactionID": null,
    "InitialPaymentID": 3006154,
    "Amount": "980",
    "Currency": null,
    "Description": null,
    "TypeID": 0,
    "SiteID": 30201,
    "Details": null,
    "Customer": null,
    "BillingAddress": null,
    "BankAddress": null,
    "Articles": [
      {
        "MerchantArticleID": "1231",
        "Name": null,
        "Quantity": 1,
        "Price": 0,
        "VAT": 0,
        "Discount": 0,
        "Type": null,
        "DiscountValue": 0
      }
    ],
    "Status": {
      "ID": 1,
      "Info": "Open",
      "Reasons": null
    }
  }
}

Capture Scenarios for Klarna Payments

 

ScenarioStatus / Return CodeDescription

The transaction has been fully captured.

Only payments with “Authorized” status can be captured.
Status: 2Success

The payment has been partially captured.

Only payments with “Authorized” status can be captured.
Status: 35Partially Captured

Retry Capture.

This happens when the request timeouts at Provider; a new capture request has to be initiated.
Return Code: 157Unable to capture transaction

The transaction could not be captured.

The transaction is not in an Authorized status.
Return Code: 17Payment is invalid

For a complete list of all the possible Return Code IDs go to our section GlobalPay Return Codes.

See the request – response examples for the above possible scenarios:

  • Success Status

    A payment can only be captured if it has an Authorized status. Once the payment has an Authorized status, you can capture either the full amount or a partial amount of the initial authorized amount for the transaction.

    A 200 HTTP response (OK) is returned if the request was completed successfully.

    Full capture means you capture the entire authorized amount for the initial transaction.

    Request:

    POST: https://paytest.smart2pay.com/v1/payments/3434057/capture
    Authorization: Basic MzAxNTE6V05ydTJ5WnJpR2RtNVVMZWt4dFM4cHprUXNRSmdYYTZBZnlnT3FXZXcvNlRBYzNYK1A=

    Response:

    HTTP/1.1 200 OK
    Content-Type: application/json; charset=utf-8
    
    {
        "Payment": {
            "ID": 3434057,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20171123140528",
            "MerchantTransactionID": "captureklarna",
            "OriginatorTransactionID": null,
            "Amount": "980",
            "Currency": "EUR",
            "CapturedAmount": "980",
            "ReturnURL": "http://demo.smart2pay.com/redirect.php",
            "Description": null,
            "MethodID": 1078,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30151,
            "NotificationDateTime": "20171123140924",
            "Customer": {
                "ID": 1524,
                "MerchantCustomerID": null,
                "Email": "youremail@email.com",
                "FirstName": "Testperson-se",
                "LastName": "Approved",
                "Gender": null,
                "SocialSecurityNumber": "410321-9202",
                "Phone": "0765260000",
                "Company": null,
                "DateOfBirth": "19700710"
            },
            "BillingAddress": {
                "ID": 1450,
                "City": "Ankeborg",
                "ZipCode": "12345",
                "State": null,
                "Street": "Stårgatan 1",
                "StreetNumber": null,
                "HouseNumber": null,
                "HouseExtension": null,
                "Country": "SE"
            },
            "ShippingAddress": {
                "ID": 1450,
                "City": "Ankeborg",
                "ZipCode": "12345",
                "State": null,
                "Street": "Stårgatan 1",
                "StreetNumber": null,
                "HouseNumber": null,
                "HouseExtension": null,
                "Country": "SE"
            },
            "Articles": [
                {
                    "MerchantArticleID": "1231",
                    "Name": "TEST",
                    "Quantity": 1,
                    "Price": "1000",
                    "VAT": "1000",
                    "Discount": "2",
                    "Type": "1",
                    "DiscountValue": "0"
                }
            ],
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 2,
                "Info": "Success",
                "Reasons": null
            },
            "MethodTransactionID": null,
            "TokenLifetime": 10,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=79F34F96810C627F6CCE8FA64D66F384.3434057"
        }
    }
  • Partially Captured Status

    Partial capture means you have the possibility to capture a smaller amount than the one from the initial authorized transaction. Partial capture is used when you have sent at least part of the order to the consumer and want to capture the amount for the item(s) that have been shipped.

    You can perform only one partial capture for an authorized transaction with the limitation that the amount of the partial capture to be smaller or equal than the initial authorized amount.

    There are 3 possibilities to partially capture a payment:

    1. Specify only the captured amount parameter in the query string, in order to partially capture the payment, like in the below example:

      Request:

      POST https://paytest.smart2pay.com/v1/payments/202239/capture?amount=1000
      Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

      Response:

      HTTP/1.1 200 OK
      Content-Type: application/json; charset=utf-8
      
      {
        "Payment": {
          "ID": 202239,
          "SkinID": 11,
          "ClientIP": null,
          "Created": "20180615085707",
          "MerchantTransactionID": "s2ptest_g241_a",
          "OriginatorTransactionID": null,
          "Amount": "2000",
          "Currency": "GBP",
          "CapturedAmount": "1000",
          "ReturnURL": "http://demo.smart2pay.com/redirect.php",
          "Description": null,
          "MethodID": 1078,
          "MethodOptionID": null,
          "IncludeMethodIDs": null,
          "ExcludeMethodIDs": null,
          "PrioritizeMethodIDs": null,
          "SiteID": 30201,
          "NotificationDateTime": "20180615085820",
          "Customer": {
            "ID": 340,
            "MerchantCustomerID": "0125",
            "Email": "youremail@email.com",
            "FirstName": "Doe",
            "LastName": "Test",
            "Gender": "0",
            "SocialSecurityNumber": "0801363945",
            "SocialSecurityNumber2": null,
            "Phone": "+440745785615",
            "Company": "S2P",
            "DateOfBirth": null
            },
          "BillingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "ShippingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "Articles": [
            {
            "MerchantArticleID": "1235",
            "Name": "Physical",
            "Quantity": 1,
            "Price": "1000",
            "VAT": "1200",
            "Discount": "0.09",
            "Type": "5",
            "DiscountValue": "100"
            }
          ],
          "Details": null,
          "ReferenceDetails": null,
          "CustomParameters": null,
          "PreapprovalID": null,
          "Status": {
            "ID": 2,
            "Info": "Success",
            "Reasons": null
            },
          "MethodTransactionID": null,
          "TokenLifetime": 10,
          "Capture": null,
          "PreapprovalDetails": null,
          "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=8E9EBC84E9E19B696BC9A805564E85A7.3897941"
        }
      }
    2. Specify the captured amount parameter in the query string and send the minimal details for the Articles object, like in the below example:

      Request:

      POST  https://paytest.smart2pay.com/v1/payments/34340570/capture?amount=1000
      Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=
      
      {
        "Payment": {
          "Articles": [
            {
            "MerchantArticleID": "1235",
            "Quantity": 1
            }
          ]
        }
      }

      Response:

      HTTP/1.1 200 OK
      Content-Type: application/json; charset=utf-8
      
      {
        "Payment": {
          "ID": 34340570,
          "SkinID": 11,
          "ClientIP": null,
          "Created": "20180615085707",
          "MerchantTransactionID": "s2ptest_g241_b",
          "OriginatorTransactionID": null,
          "Amount": "2000",
          "Currency": "GBP",
          "CapturedAmount": "1000",
          "ReturnURL": "http://demo.smart2pay.com/redirect.php",
          "Description": null,
          "MethodID": 1078,
          "MethodOptionID": null,
          "IncludeMethodIDs": null,
          "ExcludeMethodIDs": null,
          "PrioritizeMethodIDs": null,
          "SiteID": 30201,
          "NotificationDateTime": "20180615085820",
          "Customer": {
            "ID": 340,
            "MerchantCustomerID": "0125",
            "Email": "youremail@email.com",
            "FirstName": "Doe",
            "LastName": "Test",
            "Gender": "0",
            "SocialSecurityNumber": "0801363945",
            "SocialSecurityNumber2": null,
            "Phone": "+440745785615",
            "Company": "S2P",
            "DateOfBirth": null
            },
          "BillingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "ShippingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "Articles": [
            {
            "MerchantArticleID": "1235",
            "Name": "Physical",
            "Quantity": 1,
            "Price": "1000",
            "VAT": "1200",
            "Discount": "0.09",
            "Type": "5",
            "DiscountValue": "100"
            }
          ],
          "Details": null,
          "ReferenceDetails": null,
          "CustomParameters": null,
          "PreapprovalID": null,
          "Status": {
            "ID": 2,
            "Info": "Success",
            "Reasons": null
            },
          "MethodTransactionID": null,
          "TokenLifetime": 10,
          "Capture": null,
          "PreapprovalDetails": null,
          "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=8E9EBC84E9E19B696BC9A805564E85A7.3897941"
        }
      }
    3. Specify the captured amount parameter in the query string and send the appropriate details for the Articles object together with the Shipping and Customer information, like in the below example:

      Request:

      POST  https://paytest.smart2pay.com/v1/payments/3434007/capture?amount=1000
      Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=
      
      {
        "Payment": {
          "Description": "Shipped part of the order ",
          "MethodID": 1078,
          "Articles": [
            {
              "MerchantArticleID": "1231",
              "Name": "TEST",
              "Quantity": 1,
              "Price": 1000,
              "VAT": 1000,
              "Discount": 200,
              "Type": 1
            }
          ],
      "ShippingAddress": {
            "HouseExtension": "25",
            "HouseNumber": "22",
            "StreetNumber": "1",
            "State": "Iasi",
            "Street": "Stargatan",
            "ZipCode": "12345",
            "City": "Ankeborg",
            "Country": "SE"
          },
          "Customer": {
            "MerchantCustomerID": "0125",
            "FirstName": "Example",
            "LastName": "Test",
            "Gender": "1",
            "Email": "youremail@email.com",
            "Phone": "0765260000",
            "Company": "S2P"
          }
        }
      }

      Response:

      HTTP/1.1 200 OK
      Content-Type: application/json; charset=utf-8
      
      {
        "Payment": {
          "ID": 3434007,
          "SkinID": 11,
          "ClientIP": null,
          "Created": "20180615085707",
          "MerchantTransactionID": "s2ptest_g241_c",
          "OriginatorTransactionID": null,
          "Amount": "2000",
          "Currency": "GBP",
          "CapturedAmount": "1000",
          "ReturnURL": "http://demo.smart2pay.com/redirect.php",
          "Description": null,
          "MethodID": 1078,
          "MethodOptionID": null,
          "IncludeMethodIDs": null,
          "ExcludeMethodIDs": null,
          "PrioritizeMethodIDs": null,
          "SiteID": 30201,
          "NotificationDateTime": "20180615085820",
          "Customer": {
            "ID": 340,
            "MerchantCustomerID": "0125",
            "Email": "youremail@email.com",
            "FirstName": "Doe",
            "LastName": "Test",
            "Gender": "0",
            "SocialSecurityNumber": "0801363945",
            "SocialSecurityNumber2": null,
            "Phone": "+440745785615",
            "Company": "S2P",
            "DateOfBirth": null
            },
          "BillingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "ShippingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "Articles": [
            {
            "MerchantArticleID": "1235",
            "Name": "Physical",
            "Quantity": 1,
            "Price": "1000",
            "VAT": "1200",
            "Discount": "0.09",
            "Type": "5",
            "DiscountValue": "100"
            }
          ],
          "Details": null,
          "ReferenceDetails": null,
          "CustomParameters": null,
          "PreapprovalID": null,
          "Status": {
            "ID": 2,
            "Info": "Success",
            "Reasons": null
            },
          "MethodTransactionID": null,
          "TokenLifetime": 10,
          "Capture": null,
          "PreapprovalDetails": null,
          "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=8E9EBC84E9E19B696BC9A805564E85A7.3897941"
        }
      }
  • Return Code: 157 – Unable to capture transaction

    The transaction could not be captured. Retry Capture. This happens when the request timeouts at Provider.

    Request:

    POST https://paytest.smart2pay.com/v1/payments/3434068/capture
    Authorization: Basic MzAxNTE6V05ydTJ5WnJpR2RtNVVMZWt4dFM4cHprUXNRSmdYYTZBZnlnT3FXZXcvNlRBYzNYK1A=

    Response:

    HTTP/1.1 400 Bad Request
    Content-Type: application/json; charset=utf-8
    
    {
        "Payment": {
            "ID": 3434068,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20171123141730",
            "MerchantTransactionID": "testpaymentauthorized",
            "OriginatorTransactionID": null,
            "Amount": "900",
            "Currency": "DKK",
            "CapturedAmount": null,
            "ReturnURL": "http://demo.smart2pay.com/redirect.php",
            "Description": "test smart2pay",
            "MethodID": 1078,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30151,
            "NotificationDateTime": "20171123141847",
            "Customer": null,
            "BillingAddress": null,
            "ShippingAddress": null,
            "Articles": null,
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 9,
                "Info": "Authorized",
                "Reasons": [
                    {
                        "Code": 157,
                        "Info": "Unable to capture transaction"
                    }
                ]
            },
            "MethodTransactionID": null,
            "TokenLifetime": null,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": null
        }
    }
  • Return Code: 17 – Payment is invalid

    The transaction could not be captured. The transaction is not in an Authorized status. You can receive this response when the payment you want to Capture is not Authorized or when the payment has already been Captured.

    Request:

    POST https://paytest.smart2pay.com/v1/payments/3434032/capture
    Authorization: Basic MzAxNTE6V05ydTJ5WnJpR2RtNVVMZWt4dFM4cHprUXNRSmdYYTZBZnlnT3FXZXcvNlRBYzNYK1A=

    Response:

    HTTP/1.1 400 Bad Request
    Content-Type: application/json; charset=utf-8{
        "Payment": {
            "ID": 3434032,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20171123134852",
            "MerchantTransactionID": null,
            "OriginatorTransactionID": null,
            "Amount": null,
            "Currency": null,
            "CapturedAmount": null,
            "ReturnURL": null,
            "Description": null,
            "MethodID": 1078,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30151,
            "NotificationDateTime": "20171112000000",
            "Customer": null,
            "BillingAddress": null,
            "ShippingAddress": null,
            "Articles": null,
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 1,
                "Info": "Open",
                "Reasons": [
                    {
                        "Code": 17,
                        "Info": "Payment is invalid - 3434032"
                    }
                ]
            },
            "MethodTransactionID": null,
            "TokenLifetime": null,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": null
        }
    }

Multibanco SIBS Payment Request

Definition: POST https://paytest.smart2pay.com/v1/payments

Below you will find a full example of a payment request for Multibanco SIBS method (with Success and Bad response). The parameters of the payment are sent in the message body as a JSON object.

In order to display the payment details to your customers on your own page, you can send in the request the CustomerName and Country parameters. Use the information received in Response in the ReferenceDetails object.

A 201 HTTP response (Created) is returned if the payment was correctly initialized.

For more information about status codes, please go to Basic HTTP Status Codes.

Request: 

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
   "Payment": {
      "MerchantTransactionID": "s2ptest_h40",
      "Amount": "400",
      "Currency": "EUR",
      "ReturnURL": "http://demo.smart2pay.com/redirect.php",
      "Description": "SIBSTestDetails",
      "MethodID": 20,
      "BillingAddress": {
         "Country": "PT"
      },
      "Customer": {
         "FirstName": "John",
         "LastName": "Doe"
      }
   }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": 4178449,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20181107100206",
        "MerchantTransactionID": "s2ptest_h40",
        "OriginatorTransactionID": null,
        "Amount": "400",
        "Currency": "EUR",
        "CapturedAmount": null,
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": "SIBSTestDetails",
        "MethodID": 20,
        "MethodOptionID": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30201,
        "NotificationDateTime": null,
        "Customer": {
            "ID": 142823,
            "MerchantCustomerID": null,
            "Email": null,
            "FirstName": "John",
            "LastName": "Doe",
            "Gender": null,
            "SocialSecurityNumber": null,
            "SocialSecurityNumber2": null,
            "Phone": null,
            "Company": null,
            "DateOfBirth": null
        },
        "BillingAddress": {
            "ID": 705,
            "City": null,
            "ZipCode": null,
            "State": null,
            "Street": null,
            "StreetNumber": null,
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "PT"
        },
        "ShippingAddress": null,
        "Articles": null,
        "Details": null,
        "ReferenceDetails": {
            "BankCode": null,
            "BankName": null,
            "EntityID": null,
            "EntityNumber": "11302",
            "ReferenceID": null,
            "ReferenceNumber": "022 518 828",
            "SwiftBIC": null,
            "AccountCurrency": null,
            "AccountNumber": null,
            "AccountHolder": null,
            "IBAN": null,
            "AmountToPay": "4 EUR",
            "QRCodeURL": null,
            "Instructions": null
        },
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 1,
            "Info": "Open",
            "Reasons": null
        },
        "MethodTransactionID": null,
        "TokenLifetime": 1,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=DAB863DD12A9DB642BF15252CB89CAC2.4178449"
    }
}

SEPA Direct Debit Recurring Payment

Based on the PreapprovalID received, Direct Debits can be initiated.

Checkout the below example of a recurring payment request for SEPA Direct Debit (84) that is based on the PreapprovalID. Please send in the payment request the Description parameter and Country parameter that should be the same with the ones sent in the Preapproval request.

Request:

POST https://paytest.smart2pay.com/v1/payments/recurrent
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
 "Payment": {
   "PreapprovalID":13199,
   "MerchantTransactionID": "s2ptest_h13",
   "Amount": 100,
   "Currency": "EUR",
   "MethodID": 84,
   "Description":"SEPA DD recurrent payment",
   "BillingAddress": {
     "Country": "NL"
    }
  }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": 4167022,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20181101145456",
        "MerchantTransactionID": "s2ptest_h13",
        "OriginatorTransactionID": null,
        "Amount": "100",
        "Currency": "EUR",
        "CapturedAmount": null,
        "ReturnURL": null,
        "Description": "SEPA DD recurrent payment",
        "MethodID": 84,
        "MethodOptionID": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30201,
        "NotificationDateTime": null,
        "Customer": null,
        "BillingAddress": {
            "ID": 309,
            "City": null,
            "ZipCode": null,
            "State": null,
            "Street": null,
            "StreetNumber": null,
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "NL"
        },
        "ShippingAddress": null,
        "Articles": null,
        "Details": null,
        "ReferenceDetails": null,
        "CustomParameters": null,
        "PreapprovalID": 13199,
        "Status": {
            "ID": 1,
            "Info": "Open",
            "Reasons": null
        },
        "MethodTransactionID": null,
        "TokenLifetime": null,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": null
    }
}