Create a Recurring Payment

Definition: POST /v1/payments/recurrent

A recurring payment is created in the same manner a one-off payment is created. In addition, you need to send the PreapprovalID (the PreapprovalID or Mandate received when you created/opened a preapproval) and the information specific to each payment method.

For recurring Card payments (69) you do not need a preapproval, you only need to send in the preapprovalID field the initial GlobalPay PaymentID.

If you want to get more information about a recurring payment you can use the same actions like for a one-off payment. Please check Get information on a specific payment, for more details.

    • Checkout the below example of a recurring payment request for SEPA Direct Debit (84) that is based on the PreapprovalID (also send in the payment request the Description parameter and Country parameter – should be the same with the one 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
          }
      }

      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/recurrent
      Authorization: Basic MzAxOTk6OG16L0lsZkpaejIyVVhVUlFSeXRvdExQQ3pkWVJQekVmNHpyNDdBUWROWWxiUUxpTWc=
      
      {
       "Payment": {
         "PreapprovalID": 23421,
         "MerchantTransactionID": "s2ptest_h234",
         "Amount": 100,
         "Currency": "EUR",
         "MethodID": 84,
         "Description":"SEPA DD recurrent payment",
         "BillingAddress": {
           "Country": "NL"
          }
        }
      }

      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_h234",
              "OriginatorTransactionID": null,
              "Amount": "100",
              "Currency": "EUR",
              "CapturedAmount": null,
              "ReturnURL": null,
              "Description": "SEPA DD recurrent payment",
              "MethodID": null,
              "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": "12",
                          "Info": "Preapproval is invalid"
                      }
                  ]
              },
              "Fraud": null,
              "MethodTransactionID": null,
              "TokenLifetime": null,
              "Capture": null,
              "PreapprovalDetails": null,
              "RedirectURL": null,
              "Splits": null
          }
      }

When the Direct Debit is successfully executed by the bank (1-2 banking days), you will receive a similar notification with Success Status (StatusID = 2) so you can send the product to the customer.

You need to respond with HTTP code 204 (No Content)!

Payment notification format:

Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
  "Payment": {
    "ID": 4167022,
    "SkinID": null,
    "ClientIP": null,
    "Created": "20181101145458",
    "MerchantTransactionID": "s2ptest_h13",
    "OriginatorTransactionID": null,
    "Amount": "100",
    "Currency": "EUR",
    "ReturnURL": "",
    "Description": null,
    "MethodID": 84,
    "MethodOptionID": null,
    "IncludeMethodIDs": null,
    "ExcludeMethodIDs": null,
    "PrioritizeMethodIDs": null,
    "SiteID": 30201,
    "NotificationDateTime": null,
    "Customer": null,
    "BillingAddress": null,
    "ShippingAddress": null,
    "Articles": null,
    "Details": null,
    "ReferenceDetails": null,
    "CustomParameters": null,
    "PreapprovalID": 13199,
    "Status": {
      "ID": 2,
      "Info": "Success",
      "Reasons": null
    },
    "MethodTransactionID": null,
    "TokenLifetime": null,
    "Capture": null,
    "PreapprovalDetails": null,
    "RedirectURL": null
  }
}