Recurring Card Payments

For Recurring Card Payments you will need to generate a credit card token by sending the GenerateCreditCardToken parameter to true and the card details in full in the initial payment request. Afterwards, the recurring card payments will be initiated by sending the new generated token instead of the card details.

Please note that the credit card token has a usage limit that we can set. If the token is sent more times than our set limit the payment will fail.

If you initiate a Card payment and set the GenerateCreditCardToken parameter to true, the CardOnFile object is mandatory to be sent. A token element is sent in the response, containing the value of the newly created credit card token, that will be used to initiate future Recurring Payments.

For more information regarding CardOnFile object please go to our dedicated section Card on file transactions (COF).

    • See below an example of an initial card payment with the GenerateCreditCardToken parameter set to true and mandatory Card details and CardOnFile objects:

      Request:

      POST https://securetest.smart2pay.com/v1/payments
      Authorization: Basic MTAxMDpnYWJp
      
      {
        "Payment": {
          "MerchantTransactionID": "s2ptest_m20",
          "Amount": 1000,
          "Currency": "EUR",
          "ReturnURL": "http://demo.smart2pay.com/redirect.php",   
          "Card": {
            "HolderName": "John Doe",
            "Number": "4548812049400004",
            "ExpirationMonth": "05",
            "ExpirationYear": "2021",
            "SecurityCode": "123",
            "RequireSecurityCode": true
            },
          "GenerateCreditCardToken": true,
          "CardOnFile":{
               "IsInitial": true,
               "TransactionType": "Recurring"
          }
        }
      }

      Response:

      HTTP/1.1 201 Created
      Content-Type: application/json; charset=utf-8
      
      {
        "Payment": {
          "ID": 203747,
          "ClientIP": null,
          "SkinID": null,
          "Created": "20180502085305",
          "MerchantTransactionID": "s2ptest_m20",
          "OriginatorTransactionID": null,
          "Amount": "1000",
          "Currency": "EUR",
          "CapturedAmount": "0",
          "ReturnURL": "http://demo.smart2pay.com/redirect.php",
          "Description": null,
          "StatementDescriptor": null,
          "MethodID": 6,
          "MethodOptionID": null,
          "SiteID": 1010,
          "NotificationDateTime": null,
          "Customer": null,
          "BillingAddress": null,
          "ShippingAddress": null,
          "Articles": null,
          "Card": {
            "HolderName": "John Doe",
            "Number": "Ends with 0004",
            "ExpirationMonth": "05",
            "ExpirationYear": "2021",
            "IssuingBankCountry": "NL"
            },
          "CreditCardToken": {
            "Value": "C0D510746B513D66093609AA92BDA295"
            },
          "Status": {
            "ID": 9,
            "Info": "Authorized",
            "Reasons": []
            },
          "MethodTransactionID": null,
          "PaymentTokenLifetime": null,
          "Capture": false,
          "RedirectURL": null,
          "3DSecure": false,
          "CardOnFile":{
               "IsInitial": true,
               "TransactionType": "Recurring"
           },
          "Fraud": {
            "Status": "Accept",
            "CheckMode": "CheckOnPreAuthorisation",
            "Score": 31,
            "Reason": "No decision provided"
          }
        }
      }

The token received in the response of the initial payment, together with the RequireSecurityCode parameter set to false, can be used to initiate future Recurring Payments.

For Recurring Payments, the security code is not needed, you only need to send the RequireSecurityCode parameter set to false. In this case, the client will not be redirected to the form page to fill in the security code, but the payment will be directly sent to the upstream processor.

  • See below an example of a Recurring Card Payment:

    Request:

    POST https://securetest.smart2pay.com/v1/payments
    Authorization: Basic MTAxMDpnYWJp
    
    {
      "Payment": {
        "MerchantTransactionID": "s2ptest_m23",
        "Amount": 1000,
        "Currency": "EUR",
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "CreditCardToken": {
          "Value": "C0D510746B513D66093609AA92BDA295",
          "RequireSecurityCode": false
          },
        "CardOnFile": {
              "IsInitial": false,
              "TransactionType": "Recurring",
              "InitialPaymentID": 203747
        }
      }
    }

    Response:

    HTTP/1.1 201 Created
    Content-Type: application/json; charset=utf-8
    
    {
      "Payment": {
        "ID": 203751,
        "ClientIP": null,
        "SkinID": null,
        "Created": "20180502090314",
        "MerchantTransactionID": "s2ptest_m23",
        "OriginatorTransactionID": null,
        "Amount": "1000",
        "Currency": "EUR",
        "CapturedAmount": "0",
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": null,
        "StatementDescriptor": null,
        "MethodID": 6,
        "MethodOptionID": null,
        "SiteID": 1010,
        "NotificationDateTime": null,
        "Customer": null,
        "BillingAddress": null,
        "ShippingAddress": null,
        "Articles": null,
        "Card": {
          "HolderName": "John Doe",
          "Number": "Ends with 0004",
          "ExpirationMonth": "05",
          "ExpirationYear": "2021",
          "IssuingBankCountry": "NL"
          },
        "CreditCardToken": {
          "Value": "C0D510746B513D66093609AA92BDA295"
          },
        "Status": {
          "ID": 9,
          "Info": "Authorized",
          "Reasons": []
          },
        "MethodTransactionID": null,
        "PaymentTokenLifetime": null,
        "Capture": false,
        "RedirectURL": null,
        "3DSecure": false,
        "CardOnFile": {
              "IsInitial": false,
              "TransactionType": "Recurring",
              "InitialPaymentID": 203747
        },
        "Fraud": {
          "Status": "Accept",
          "CheckMode": "CheckOnPreAuthorisation",
          "Score": 31,
          "Reason": "No decision provided"
        }
      }
    }
  • For LATAM region it is mandatory to send in the initial Card payment the Country parameter for the Billing Address together with the Email parameter and the SocialSecurityNumber parameter of the Customer. You also need to set the GenerateCreditCardToken parameter to true and a token element is sent in the response, containing the value of the newly created credit card token. Checkout the example below of an initial card payment with all the mandatory parameters to be sent for LATAM region:

    Request:

    POST https://securetest.smart2pay.com/v1/payments
    Authorization: Basic MTAxMDpnYWJp
    
    {
      "Payment": {
        "MerchantTransactionID": "s2ptest_m21",
        "Amount": 1000,
        "Currency": "EUR",
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",   
        "Card": {
          "HolderName": "John Doe",
          "Number": "4548812049400004",
          "ExpirationMonth": "05",
          "ExpirationYear": "2021",
          "SecurityCode": "123",
          "RequireSecurityCode": true
          },
        "Customer": {
          "Email": "customer@test.com",
          "SocialSecurityNumber": "45908-28324"
        },
        "GenerateCreditCardToken": true,
        "CardOnFile": {
              "IsInitial": true,
              "TransactionType": "Recurring"
        }
      }
    }

    Response:

    HTTP/1.1 201 Created
    Content-Type: application/json; charset=utf-8
    
    {
      "Payment": {
        "ID": 203746,
        "ClientIP": null,
        "SkinID": null,
        "Created": "20180502085305",
        "MerchantTransactionID": "s2ptest_m20",
        "OriginatorTransactionID": null,
        "Amount": "1000",
        "Currency": "EUR",
        "CapturedAmount": "0",
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": null,
        "StatementDescriptor": null,
        "MethodID": 6,
        "MethodOptionID": null,
        "SiteID": 1010,
        "NotificationDateTime": null,
        "Customer": {
          "ID": 115,
          "MerchantCustomerID": "null",
          "Email": "customer@test.com",
          "FirstName": "John",
          "LastName": "Doe",
          "Gender": "1",
          "SocialSecurityNumber": "45908-28324",
          "Phone": "0744-783322",
          "Company": "S2P"
        },
        "BillingAddress": null,
        "ShippingAddress": null,
        "Articles": null,
        "Card": {
          "HolderName": "John Doe",
          "Number": "Ends with 0004",
          "ExpirationMonth": "05",
          "ExpirationYear": "2021",
          "IssuingBankCountry": "NL"
          },
        "CreditCardToken": {
          "Value": "C0D510746B513D66093609AA92BDA295"
          },
        "Status": {
          "ID": 9,
          "Info": "Authorized",
          "Reasons": []
          },
        "MethodTransactionID": null,
        "PaymentTokenLifetime": null,
        "Capture": false,
        "Retry": false,
        "RedirectURL": null,
        "3DSecure": false,
        "CardOnFile": {
              "IsInitial": true,
              "TransactionType": "Recurring"
        },
        "Fraud": {
          "Status": "Accept",
          "CheckMode": "CheckOnPreAuthorisation",
          "Score": 31,
          "Reason": "No decision provided"
        }
      }
    }

    The token received in the response of the initial payment, can be used to initiate future Recurring Payments for LATAM region, like in the below example:

    Request:

    POST https://securetest.smart2pay.com/v1/payments
    Authorization: Basic MTAxMDpnYWJp
    
    {
      "Payment": {
        "MerchantTransactionID": "s2p_m6",
        "Amount": 10000,
        "Currency": "BRL",
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "CreditCardToken": {
          "Value": "F43F90A5CB613D91F704407D4E297EA1"
          },
        "GenerateCreditCardToken": true,
        "CardOnFile": {
              "IsInitial": false,
              "TransactionType": "Recurring",
              "InitialPaymentID": 203746
        }
      }
    }

    Response:

    HTTP/1.1 201 Created
    Content-Type: application/json; charset=utf-8
    
    {
      "Payment": {
        "ID": 203754,
        "ClientIP": null,
        "SkinID": null,
        "Created": "20180430092243",
        "MerchantTransactionID": "s2p_m6",
        "OriginatorTransactionID": null,
        "Amount": "10000",
        "Currency": "BRL",
        "CapturedAmount": "0",
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": null,
        "StatementDescriptor": null,
        "MethodID": 6,
        "MethodOptionID": null,
        "SiteID": 1010,
        "NotificationDateTime": null,
        "Customer": null,
        "BillingAddress": null,
        "ShippingAddress": null,
        "Articles": null,
        "Card": {
          "HolderName": "John Doe",
          "Number": "",
          "ExpirationMonth": "05",
          "ExpirationYear": "2021",
          "IssuingBankCountry": "NL"
          },
        "CreditCardToken": {
          "Value": "F43F90A5CB613D91F704407D4E297EA1"
          },
        "Status": {
          "ID": 9,
          "Info": "Authorized",
          "Reasons": []
          },
        "MethodTransactionID": null,
        "PaymentTokenLifetime": null,
        "Capture": false,
        "RedirectURL": null,
        "3DSecure": false,
        "CardOnFile": {
              "IsInitial": false,
              "TransactionType": "Recurring",
              "InitialPaymentID": 203746
        },
        "Fraud": {
          "Status": "Accept",
          "CheckMode": "CheckOnPreAuthorisation",
          "Score": 31,
          "Reason": "No decision provided"
        }
      }
    }