# Create a Hosted payment page

To authorize a payment, make a call to the Hosted payment page endpoint. It will handle the authorization process by verifying payment details, checking funds, and meeting security requirements. Upon successful authorization, customer will redirect back to the merchant's website.

# Creating a Hosted Payment Page session

POST: https://api.openacquiring.com/v1/merchants/YOUR_MERCHANT_ID/hosted-payment
Request Example
  • Shell
  • JavaScript
curl -X POST \
  https://api.openacquiring.com/v1/merchants/w3z8dfhkzvfq0j9n/hosted-payment \
  -H 'authorization: Basic ODZidWQ0Y2JremlxOXZmYzoweHI1ZDkwOHo2bmo4a2h6' \
  -H 'content-type: application/json' \
  -d '
    {
        "intent": "sale",
        "payer": {
            "payment_type": "CC",
            "payer_info": {
                "email": "TomHanks@gmail.com",
                "billing_address": {
                    "line1": "18 Avenue",
                    "line2": "cassidy",
                    "city": "Rose-Hill",
                    "country_code": "mu",
                    "postal_code": "72101",
                    "state": "",
                    "phone": {
                        "country_code": "230",
                        "number": "57976041"
                    }
                }
            }
        },
        "transaction": {
            "amount": {
                "currency": "USD",
                "total": "300"
            },
            "description": "purchase",
            "items": [
                {
                    "sku": "100299S",
                    "name": "Ultrawatch",
                    "description": "Smart watch",
                    "quantity": "a0",
                    "price": "500",
                    "shipping": "20",
                    "currency": "USD",
                    "url": "",
                    "image": "",
                    "tangible": "true"
                },
                {
                    "sku": "100269S",
                    "name": "Drone",
                    "description": "drone x",
                    "quantity": "1",
                    "price": "500",
                    "shipping": "20",
                    "currency": "USD",
                    "url": "",
                    "image": "",
                    "tangible": "true"
                }
            ],
            "invoice_number": "123455",
            "return_url": "https://opac.com/returnUrl"
        },
        "metadata": {
            "customerip": "145.239.223.178"
        }
    }'
Response example
{
    "invoice_number": "123455",
    "hosted_page_link": "https://api.openacquiring.com/v1/merchants/w3z8dfhkzvfq0j9n/hosted-payment/page/a3dd9808-cc48-4e5d-827f-838cfd798a65"
}

# Redirect payer

After successfully creating the Hosted Payment Page session, the payer is redirected to the hosted_page_link received in the above response, using either a server-side or client-side call.

# Payment completed

After successfully completing the payment, the payer will be redirected to the return_url provided in the request. The hosted payment session Id is provided in hosted-payment-session-id query parameter included in the redirect URL.

# Request

# Header parameters

The request require a Basic authentication in the header. For more information about HTTP request headers, see HTTP request headers.

# Request parameters

  • # merchant_id string required

    Encrypted Merchant account identifier for the Merchant.

# Request body

  • # intent enum required

    The payment intent. Value is:

    • sale. Makes an immediate payment.
    • auth. Authorizes a payment for capture later

    Allowed values: sale, auth.

  • # payer object required

    Defines the payer details

  • # transaction object required

    Defines what the payment is for and who fulfills the payment.

  • # metadata ArrayOf(KeyValuePair(string, string))

    contains additional information about the transaction

# Payer

  • # payment_type enum

    Payment type being used. Value is:

    • CC : Credit card
  • # payer_info object

    Information related to the Payer.

# payer_info

  • # id string

    Encrypted Payer ID.

  • # email string

    Email address representing the payer. 127 characters max.

  • # name string

    Full Name of the payer

  • # billing_address object

    Birth date of the Payer in ISO8601 format (yyyy-mm-dd).

# billing_address

  • # line1 string

    The first line of the address. For example, number, street, and so on.

    Maximum length: 100.

  • # line2 string

    The second line of the address. For example, suite or apartment number.

    Maximum length: 100.

  • # city string

    The city name.

    Maximum length: 64.

  • # country_code string

    two-character ISO 3166-1 code that identifies the country or region. Note: The country code for Great Britain is GB and not UK as used in the top- level domain names for that country.

    Minimum length: 2.

    Maximum length: 2.

    Pattern: ^([A-Z]{2}|C2)$.

  • # postal_code string

    The postal code, which is the zip code or equivalent.

  • # state string

    2 letter code for US states, and the equivalent for other countries.

  • # phone object

    Information related phone number.

# phone

  • # country_code string

    Country code (from in E.164 format)

  • # number string

    In-country phone number (from in E.164 format). Maximum length is 25 characters.

# transaction

  • # amount object

    The amount to collect.

  • # description string

    Description of what is being paid for.

  • # items array(item)

    List of items being paid for.

  • # return_url string

    URL to send payment notifications(Maximum length: 2048.)

  • # cancel_url string

    Url to send payer incase payment is denied.

  • # invoice_number string

    invoice number to track this payment (Maximum length: 50.)

  • # soft_descriptor object

    Dynamic Soft descriptor used when charging this funding source.

# amount

  • # currency string

    The three-character ISO-4217 currency code.

  • # total string

    The total amount charged to the payee by the payer. Maximum length is 10 characters, which includes:

    • Seven digits before the decimal point.
    • The decimal point.
    • Two digits after the decimal point.

# soft_descriptor

  • # text string

    The soft descriptor text to use to charge this funding source. If greater than the maximum allowed length, the API truncates the string.

    Maximum length: 22.

  • # country string

    The soft descriptor country to use to charge this funding source.

    two-character ISO 3166-1 code that identifies the country or region.

# item

  • # sku string

    The stock keeping unit (SKU) for the item.

  • # name string

    The item name. If this value is greater than the maximum allowed length, the API truncates the string.

  • # description string

    The item description.

  • # quantity string

    The item quantity. Must be a whole number. Maximum length: 10.

    Pattern: ^[0-9]{0,10}$.

  • # price string

    The item cost. Supports two decimal places. Pattern: ^[0-9]{0,10}(\.[0-9]{0,2})?$

  • # shipping string

    The shipping cost

  • # currency string

    The three-character ISO-4217 currency code.

  • # image string

    URI to an image representing the item

  • # tangible bool

    Identifies if the item is a tangible or not

# Response

	{
        "invoice_number": "123455",
        "hosted_page_link": "https://api.openacquiring.com/v1/merchants/w3z8dfhkzvfq0j9n/hosted-payment/page/a3dd9808-cc48-4e5d-827f-838cfd798a65"
    }

# Response Body

# Status 200 Success

Parameter Type Description
invoice_number string invoice number to track this payment
hosted_page_link string The link related to the hosted payment page

# Error Response Body

# Status 400 Bad Request

Parameter Type Description
code string Code indentifying the error on our system
name string Name indentifying the error on our system
message string Message related to the error
eventId string Unique Identifier for the request

# Status 422 Unprocessable Entity

The request was well-formed but was unable to be follewed due to semantic errors.

Parameter Type Description
eventId string Unique Identifier for the request
errors arrayOf(error) Array of errors

# errors object

Parameter Type Description
code string Code indentifying the error on our system
name string Name indentifying the error on our system
message string Message related to the error
Last Updated: 8/29/2023, 12:45:13 PM