Creating a custom payment page link

AffiniPay creates a payment page for each of a merchant’s processing accounts. Using the API, you can retrieve the URL for a payment page and display a link to the pre-populated payment page from within your application. Use the following steps:

  1. Retrieve the payment page.
  2. Define pre-filled fields.
  3. Create the custom payment page link.

1: Retrieve the payment page

Retrieve the link to the payment page. From within your application, the merchant must be able to choose which payment page they would like to access.

Example request: Retrieving a list of payment pages for the merchant
curl -X GET https://api.affinipay.com/payment-pages \ -H 'Authorization:Bearer<oauth-access-token>'
Example response
{
    "payment_pages": [
        {
            "id": 1279,
            "title": "Invoice Payment",
                "merchant_account_id" : "-4doteloQnuNVM3o9ukr1A",
                "ach_account_id": "O7CQOQmdRFCFOG_0c3mpNg",
            "payment_link_subject": "Request for Payment",
            "payment_link_body": "Dear customer,\r\nFor your convenience, our firm accepts payments online. To make a payment, please click the link below:\r\n",
            "description": "Payment Detail",
            "public_url": "https://secure.affinipay.com/pages/mybusiness/myaccount"
        },
        {
            "id": 1909,
            "title": "Invoice Payment",
                "merchant_account_id" : "gRoxK5R8HgmlQrmSbRJnkA",
                "ach_account_id": null,
            "payment_link_subject": "Request for Payment",
            "payment_link_body": "Dear customer,\r\nFor your convenience, our firm accepts payments online. To make a payment, please click the link below:\r\n",
            "description": "Payment Detail",
            "public_url": "https://secure.affinipay.com/pages/mybusiness/mytrust"
        }
    ]
}

2: Define pre-filled fields

You can pre-populate fields on the payment page by adding query parameters to the payment page URL. Although it is not required, populating amount and reference (for marrying the payment back to your system) is recommended.

Here is a list of fields:

ParameterURL Syntax
namename=Dave%20Bowman
amountamount=1000
address1address1=2001%20Odyssey%20Ln
address2address2=Suite%20200
citycity=Austin
statestate=TX
postal_codepostal_code=78727
countrycountry=US
phonephone=5123214321
referencereference=1968
emailemail=officeadmin@​example.com
Invoice (note capital I)Invoice=3845
recur_frequencyrecur_frequency=YEAR

In addition, you can include the parameter readOnlyFields with a comma-separated list of other parameters in the payment page URL. This marks fields on the form uneditable as to not disrupt important information such as amount or reference.

To create a custom payment page link, use the following formula:

payment_page_URL?parameter1_name=parameter1_value&parameter2_name=parameter2_value&readOnlyFields=parameter3,parameter4

For example:

https://secure.affinipay.com/pages/mybusiness/myaccount?reference=Office%20Visit&amount=1000&readOnlyFields=reference,amount

This link opens the MyBusiness merchant’s branded payment page for their MyAccount processing account. On the page, the reference field is pre-populated with the text “Office Visit” and the amount field is pre-populated with the value “$1000”. Neither of these fields can be edited by the user, due to the readOnlyFields parameter.