Create a Complex Payment

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

Below you will find a full example of a payment request (with Success and Bad response). The parameters of the payment are sent in the message body as a JSON 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:

GET https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzA1NjM6WVlxMEVtZHFYRlNwS0REeUw1Wjd5SGp0cTdXNExlU1dUWTRIcnFHL0VlSnV4ckRXRUg= 
{
    "Payment": {
        "Amount": 1400,
        "Currency": "EUR",
        "Description": "testy smart2pay",
        "MethodID": 1078,
        "ReturnURL": "https://demo2.smart2pay.com/redirect.php",
        "MerchantTransactionID": "TestKlarnaPaymentsUS1_{{$randomInt}}",
        "Articles": [
            {
                "MerchantArticleID": "1235",
                "Quantity": 2,
                "Name": "Physical",
                "Price": 900,
                "VAT": 300,
                "DiscountValue": 0,
                "Type": 5,
                "ProductUrl": "https://product.url.com",
                "ImageUrl": "https://image.url.com"
            },
            {
                "MerchantArticleID": "1237",
                "Quantity": 2,
                "Name": "Discount",
                "Price": 200,
                "DiscountValue": 0,
                "Type": 4,
                "ProductUrl": "https://product.url.com",
                "ImageUrl": "https://image.url.com"
            }
        ],
        "BillingAddress": {
            "ZipCode": "90210",
            "State": "CA",
            "City": "Beverly Hills",
            "Street": "Lombard St 10",
            "StreetNumber": "Apt 214",
            "Country": "DE"
        },
        "ShippingAddress": {
            "ZipCode": "90210",
            "State": "CA",
            "City": "Beverly Hills",
            "Street": "Lombard St 10",
            "StreetNumber": "Apt 214",
            "Country": "DE"
        },
        "Customer": {
            "Email": "Testy_alex@email.com",
            "Phone": "8638691164",
            "FirstName": "Testy",
            "LastName": "Alex"
        },
        "TokenLifetime": 10
    }
}

Response:

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

{
    "Payment": {
        "ID": 8066818,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20250320124947",
        "MerchantTransactionID": "TestKlarnaPaymentsUS1_30",
        "OriginatorTransactionID": null,
        "Amount": "1400",
        "Currency": "EUR",
        "CapturedAmount": null,
        "ReturnURL": "https://demo2.smart2pay.com/redirect.php",
        "ReturnURLSuccess": null,
        "ReturnURLFailure": null,
        "ReturnURLCancel": null,
        "ReturnURLProcessing": null,
        "Description": "testy smart2pay",
        "MethodID": 1078,
        "MethodOptionID": null,
        "MethodOptionIdString": null,
        "BankName": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30563,
        "NotificationDateTime": null,
        "Customer": {
            "MerchantCustomerID": null,
            "Email": "Testy_alex@email.com",
            "FirstName": "Testy",
            "LastName": "Alex",
            "Gender": null,
            "SocialSecurityNumber": null,
            "Phone": "8638691164",
            "Company": null,
            "DateOfBirth": null
        },
        "BillingAddress": {
            "ID": 17064,
            "City": "Beverly Hills",
            "ZipCode": "90210",
            "State": "CA",
            "Street": "Lombard St 10",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "DE"
        },
        "ShippingAddress": {
            "ID": 17064,
            "City": "Beverly Hills",
            "ZipCode": "90210",
            "State": "CA",
            "Street": "Lombard St 10",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "DE"
        },
        "Articles": [
            {
                "MerchantArticleID": "1235",
                "Name": "Physical",
                "Quantity": 2,
                "Price": "900",
                "VAT": "300",
                "Discount": "0",
                "Type": "5",
                "ImageUrl": "https://image.url.com",
                "ProductUrl": "https://product.url.com",
                "TaxType": 0,
                "DiscountValue": "0"
            },
            {
                "MerchantArticleID": "1237",
                "Name": "Discount",
                "Quantity": 2,
                "Price": "200",
                "VAT": "0",
                "Discount": "0",
                "Type": "4",
                "ImageUrl": "https://image.url.com",
                "ProductUrl": "https://product.url.com",
                "TaxType": 0,
                "DiscountValue": "0"
            }
        ],
        "Details": null,
        "ReferenceDetails": null,
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 1,
            "Info": "Open",
            "Reasons": null
        },
        "Fraud": null,
        "MethodTransactionID": null,
        "OriginalMerchantTID": null,
        "Unknown": false,
        "TokenLifetime": 10,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": "https://webapp-apm-globalpay-api-qa.nuvei.com/Home?PaymentToken=D867F21C35B0C30982B50A1D8A91A47B.8066818",
        "Splits": 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:

GET https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzA1NjM6WVlxMEVtZHFYRlNwS0REeUw1Wjd5SGp0cTdXNExlU1dUWTRIcnFHL0VlSnV4ckRXRUg= 
{
  "Payment": {
    "Amount": 980,
    "Currency": "EUR",
    "Description": "smart2pay test",
    "MethodID": 1078,
    "MethodOptionID": 0,
    "PreapprovalID": 0,
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",
    "MerchantTransactionID": "s2ptest_i22",
    "OriginatorTransactionID": null,
    "SkinID": 11,
    "RedirectInIframe": true,
    "RedirectMerchantInIframe": true,
    "IncludeMethodIDs": [75,23,1],
    "ExcludeMethodIDs": [9,28],
    "PrioritizeMethodIDs": [1,23,73],
    "ClientIP": "82.208.151.137",
    "Articles": [
      {
        "MerchantArticleID": "1231",
        "Name": "TEST",
        "Quantity": 1,
        "Price": 1000,
        "VAT": 1000,
        "Discount": 200,
        "DiscountValue": 0,
        "Type": "5"
        }
    ],
    "BillingAddress": {
      "HouseExtension": "25",
      "HouseNumber": "22",
      "StreetNumber": "1",
      "State": "Iasi",
      "Street": "Stargatan",
      "ZipCode": "12345",
      "City": "Ankeborg",
      "Country": "SEE"
    },
    "ShippingAddress": {
      "HouseExtension": "25",
      "HouseNumber": "22",
      "StreetNumber": "1",
      "State": "Iasi",
      "Street": "Stargatan",
      "ZipCode": "12345",
      "City": "Ankeborg",
      "Country": "SE"
    },
    "Customer": {
        "MerchantCustomerID": "0125",
        "Email": "youremail@email.com",
        "FirstName": "Example",
        "LastName": "Test",
        "Gender": "1",
        "SocialSecurityNumber": null,
        "Phone": "0765260000",
        "Company": "S2P",
        "DateOfBirth": "19800519"
        },
    "TokenLifetime": 10,
    "Details": {    
      "PrepaidCard": "2222222222",
      "PrepaidCardPIN": "3333",
      "ReferenceNumber": "test_test_test1"
      },
    "CustomParameters": {
        "echo": "test123asdfghddjkl;"
      }
   }
}

Response:

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

{
    "Payment": {
        "ID": 4409804,
        "SkinID": 11,
        "ClientIP": null,
        "Created": "20190311153257",
        "MerchantTransactionID": "s2ptest_i22",
        "OriginatorTransactionID": null,
        "Amount": "980",
        "Currency": "EUR",
        "CapturedAmount": null,
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "ReturnURLSuccess": null,
        "ReturnURLFailure": null,
        "ReturnURLCancel": null,
        "ReturnURLProcessing": null,
        "Description": "smart2pay test",
        "MethodID": 1078,
        "MethodOptionID": null,
        "IncludeMethodIDs": [
            75,
            23,
            1
        ],
        "ExcludeMethodIDs": [
            9,
            28
        ],
        "PrioritizeMethodIDs": [
            1,
            23,
            73
        ],
        "SiteID": 30201,
        "NotificationDateTime": "20190311153257",
        "Customer": null,
        "BillingAddress": null,
        "ShippingAddress": null,
        "Articles": null,
        "Details": null,
        "ReferenceDetails": null,
        "CustomParameters": null,
        "PreapprovalID": 0,
        "Status": {
            "ID": 4,
            "Info": "Failed",
            "Reasons": [
                {
                    "Code": "147",
                    "Info": "Address details are invalid (BillingAddress)Country - RegEx: ^[a-zA-Z]{2}$;"
                }
            ]
        },
        "Fraud": null,
        "MethodTransactionID": null,
        "OriginalMerchantTID": null,
        "Unknown": false,
        "TokenLifetime": null,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": null,
        "Splits": null 
    }
}