Recurring Payments (Subscriptions) - Initial

Scheduled or Unscheduled MIT (Merchant Initiated transactions) have changed according to PSD2.

In order to be able to deduct an amount from a customers card using an MIT(Merchant Initiated Transactions), in the future programmatically, without the need of the customer to be present please follow the guide bellow.

Initial Payment flow

In this guide will assume that you have already integrated and using our Payform solution.

In case you are not, please read and implement our Payform before you continue forward.

• Step 1: Add the 'frequencyType' parameter

Pass the following parameter frequencyType='recurring' within the payload that you initialize the Payform with.

var payload = {
  pk: 'your-public-key',
  amount: 1000,
  locale: 'el',
  frequencyType: 'recurring',
}

• Step 2: Charge the card

Continue by charging the card as you would do normally, by sending the 'ctn_' token you received by the Payform, to our Payments API

*You can pass a reference to the specific payment by using the 'mandate_reference' field which is optional.

• Step 3: Store details for subsequent payments

In order to be able to perform an MIT transaction later on, using your server programmatically, you need to store the following values:

1) Store the 'mandate' from the API response (man_xxxxxxxxxxxxxxx).

{
  ...
  "additional_amount": 0,
  "transfers": [],
  "mandate": "man_xxxxxxxxxxxxxxx"
}

2) Store the customer token from the API response (cus_xxxxxxxxxxxxxxx)

{
  ...
  "customer": {
    "token": "cus_xxxxxxxxxxxxxxx",
    "description": null,
    "email": 'john@doe.com',
    ...
}

Optional - you can store the 'mandate_reference' if you have passed it and you want to associate this recurring payment in your Database

Optional - In case you have more than one card per customer, you can save the card token (crd_xxxxxxxxxxxxxxx). Please refer to our Cards API for more information regarding card and customer management

• Initial recurring API response example:

{
    "token": "pmt_xxxxxxxxxxxxxxx",
    "date_created": "2021-06-03T14:34:09+0300",
    "description": "hey",
    "currency": "EUR",
    "status": "Captured",
    "is_captured": true,
    "amount": 50000,
    "captured_amount": 50000,
    "refund_amount": 0,
    "fee_amount": 607,
    "payee_email": null,
    "payee_phone": null,
    "merchant_ref": null,
    "under_review": false,
    "card": {
        "token": "crd_xxxxxxxxxxxxxxx",
        "type": "Visa",
        "bin": "423456",
        "last_four": "1111",
        "expiration_month": "01",
        "expiration_year": "2025",
        "holder_name": "STAGING NAME",
        "status": "valid",
        "customer": "cus_xxxxxxxxxxxxxxx",
        "friendly_name": "Visa •••• 1111 (01/2025)",
        "billing": {
            "country": "GR",
            "city": null,
            "state": "A",
            "postal_code": null,
            "address_line1": null,
            "address_line2": null
        },
        "issuer": "JPMORGAN CHASE BANK, N.A.",
        "issuer_country": "US",
        "tds": {
            "enrolled": "Υ",
            "eci_flag": "05",
            "auth_code": null,
            "auth_desc": null
        }
    },
    "customer": {
        "token": "cus_xxxxxxxxxxxxxxx",
        "description": null,
        "email": null,
        "full_name": "John Doe",
        "is_active": true,
        "date_created": "2021-06-03T14:23:26+0300",
        "date_modified": "2021-06-03T14:34:09+0300",
        "card": {
            "token": "crd_xxxxxxxxxxxxxxx",
            "type": "Visa",
            "bin": "423456",
            "last_four": "1111",
            "expiration_month": "01",
            "expiration_year": "2025",
            "holder_name": "John Doe",
            "status": "valid",
            "customer": "cus_xxxxxxxxxxxxxxx",
            "friendly_name": "Visa •••• 1111 (01/2025)",
            "billing": {
                "country": "GR",
                "city": null,
                "state": "A",
                "postal_code": null,
                "address_line1": null,
                "address_line2": null
            },
            "issuer": "JPMORGAN CHASE BANK, N.A.",
            "issuer_country": "US",
            "tds": {
                "enrolled": "Υ",
                "eci_flag": "05",
                "auth_code": null,
                "auth_desc": null
            }
        },
        "cards": {
            "count": 1,
            "data": [
                {
                    "token": "crd_xxxxxxxxxxxxxxx",
                    "type": "Visa",
                    "bin": "423456",
                    "last_four": "1111",
                    "expiration_month": "01",
                    "expiration_year": "2025",
                    "holder_name": "John Doe",
                    "status": "valid",
                    "customer": "cus_xxxxxxxxxxxxxxx",
                    "friendly_name": "Visa •••• 1111 (01/2025)",
                    "billing": {
                        "country": "GR",
                        "city": null,
                        "state": "A",
                        "postal_code": null,
                        "address_line1": null,
                        "address_line2": null
                    },
                    "issuer": "JPMORGAN CHASE BANK, N.A.",
                    "issuer_country": "US",
                    "tds": {
                        "enrolled": "Υ",
                        "eci_flag": "05",
                        "auth_code": null,
                        "auth_desc": null
                    }
                }
            ]
        }
    },
    "failure_code": null,
    "failure_message": null,
    "metadata": {},
    "is_settled": false,
    "refunded": false,
    "refunds": [],
    "installments_count": 0,
    "installments": [],
    "shipping": null,
    "payment_notification": null,
    "split": false,
    "transfer_amount": 0,
    "commission_amount": 0,
    "additional_amount": 0,
    "transfers": [],
    "mandate": "man_xxxxxxxxxxxxxxx",
    "mandate_reference": null
}