# 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
Encrypted Merchant account identifier for the Merchant.stringrequired
# Request body
# intent
enumrequiredThe payment intent. Value is:
sale. Makes an immediate payment.auth. Authorizes a payment for capture later
Allowed values:
sale,auth.# payer
objectrequiredDefines the payer details
# transaction
objectrequiredDefines what the payment is for and who fulfills the payment.
# metadata
ArrayOf(KeyValuePair(string, string))contains additional information about the transaction
# Payer
# payment_type
enumPayment type being used. Value is:
CC: Credit card
# payer_info
objectInformation related to the Payer.
# payer_info
# id
stringEncrypted Payer ID.
# email
stringEmail address representing the payer. 127 characters max.
# name
stringFull Name of the payer
# billing_address
objectBirth date of the Payer in ISO8601 format (yyyy-mm-dd).
# billing_address
# line1
stringThe first line of the address. For example, number, street, and so on.
Maximum length: 100.
# line2
stringThe second line of the address. For example, suite or apartment number.
Maximum length: 100.
# city
stringThe city name.
Maximum length: 64.
# country_code
stringtwo-character ISO 3166-1 code that identifies the country or region. Note: The country code for Great Britain is
GBand notUKas used in the top- level domain names for that country.Minimum length: 2.
Maximum length: 2.
Pattern:
^([A-Z]{2}|C2)$.# postal_code
stringThe postal code, which is the zip code or equivalent.
# state
string2 letter code for US states, and the equivalent for other countries.
# phone
objectInformation related phone number.
# phone
# country_code
stringCountry code (from in E.164 format)
# number
stringIn-country phone number (from in E.164 format). Maximum length is 25 characters.
# transaction
# amount
objectThe amount to collect.
# description
stringDescription of what is being paid for.
# items
array(item)List of items being paid for.
# return_url
stringURL to send payment notifications(Maximum length: 2048.)
# cancel_url
stringUrl to send payer incase payment is denied.
# invoice_number
stringinvoice number to track this payment (Maximum length: 50.)
# soft_descriptor
objectDynamic Soft descriptor used when charging this funding source.
# amount
# currency
stringThe three-character ISO-4217 currency code.
# total
stringThe 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
stringThe 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
stringThe soft descriptor country to use to charge this funding source.
two-character ISO 3166-1 code that identifies the country or region.
# item
# sku
stringThe stock keeping unit (SKU) for the item.
# name
stringThe item name. If this value is greater than the maximum allowed length, the API truncates the string.
# description
stringThe item description.
# quantity
stringThe item quantity. Must be a whole number. Maximum length: 10.
Pattern:
^[0-9]{0,10}$.# price
stringThe item cost. Supports two decimal places. Pattern:
^[0-9]{0,10}(\.[0-9]{0,2})?$# shipping
stringThe shipping cost
# currency
stringThe three-character ISO-4217 currency code.
# image
stringURI to an image representing the item
# tangible
boolIdentifies 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 |