Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There are two ways to process a credit card:

1. ECOM (which usually requires 3DS)

ECOM payment is the default type and returns an acsform, which is a HTML from used to perform the 3DS authentication.

A HTML page should be send to the user which include the acsform in the body and the following JS in the header:

Code Block
<script>
  onload = () => document.forms[0].submit();
</script>

The user will complete the 3DS form and submit.

After submission, the user will be returned to the predefined return URL with an encoded transaction ID.

2. MOTO (without 3DS).

MOTO payment processes the payment without the 3DS check. Once the payment is processed the user will be returned to the predefined return URL with an url encoded transaction response.

Anchorcc-process-ecomcc-process-ecomCreate Credit Card Payment for ECOM

POST /pay/v1/creditcards

Headers

Content-Typestring
Content type.Authorizationstring
Access token generated from create token request.User-Agentstring
User agent.Acceptstring
AcceptAccept-Encodingstring
Accept encoding.Accept-Charsetstring
Accept charset.

Attributes

payment_intentstring
Payment intent token.paymentTokenstring
Payment token generated from Create Payment Token request.typestring
Type 1 is ECOM payment and type 2 is MOTO.raw_amountfloat
Payment amount.customer_emailstring
Customer email.customer_namestring
Customer name.customer_addressstring (optional)
User’s address details.customer_postcodestring (optional)
User’s postcode.transaction_uniquestring
Transaction unique.device_timezoneinteger
Device timezone value which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.device_capabilitiesstring
Device capabilities which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.device_accept_languagestring
Device accept language which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.device_screen_resolutionstring
Device accept language which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.remote_addressstring
Remote address which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.

merchant_data json (optional)
The merchant can add custom key value pairs in JSON format, for example:

Code Block
{
  "my_order_id": 123,
  "fancy_note": "Order complete",
  "card_discount": false
}

Request

Code Block
POST https://secure.blinkpayment.co.uk/api/pay/v1/creditcards HTTP/1.1
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG...
User-Agent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
Accept: "*/*"
Accept-Encoding: "gzip, deflate, br"
Accept-Charset: ""

{
    "payment_intent": "pi_Swhc84aSLtUGppvPARX...",
    "paymentToken": "eyJwYXltZW50VG9rZW4iOns...",
    "type": 1,
    "raw_amount": 1.1,
    "customer_email": "random@email.com",
    "customer_name": "A Smith",
    "transaction_unique": "PHnRNzjUw...",
    "device_timezone" : "-330",
    "device_capabilities" : "javascript",
    "device_accept_language" : "en-GB",
    "device_screen_resolution" : "1366x768x24",
    "remote_address" : "123.123.123.123",
    "merchant_data": "{\"my_order_id\": \"cc-12345678\"}"
}

Response

Code Block
HTTP/1.1 200 OK
Content-Type: application/json

{
   "acsform": "<form id="form3ds22" method="post" action="https://acs.********"><input type="hidden" name="creq" value="********">
     <input type="hidden" name="threeDSPageSessions[427**************][bfreq]" value="*******">
     <input type="hidden" name="threeDSPageSessions[427**************][threeDSRef]" value="****">
     <input id="btnSubmit" type="submit" class="button expanded btn btn-primary" value="Process Payment">
     </form>"
}

HTML Page

Code Block
<!DOCTYPE html>
<html>
<head>
  <script>
    onload = () => document.forms[0].submit();
  </script>
</head>

<body>
  <form id="form3ds22" method="post" action="https://acs.********"><input type="hidden" name="creq" value="********">
    <input type="hidden" name="threeDSPageSessions[427**************][bfreq]" value="*******">
    <input type="hidden" name="threeDSPageSessions[427**************][threeDSRef]" value="****">
    <input id="btnSubmit" type="submit" class="button expanded btn btn-primary" value="Process Payment">
  </form>
</body>
</html>

Response

Code Block
HTTP/1.1 200 OK
Content-Type: application/json

{
    "url": "https://api-demo-php.blinkpayment.co.uk/return?transaction_id=BL-MYU12345&status=captured&note=Payment%2BSuccessful&merchant_data=%257B%2522order_id%2522%253A%2522cc-12345678%2522%257D"
}
Anchorcc-process-motocc-process-motoCreate Credit Card Payment for MOTO

POST /pay/v1/creditcards

Headers

Content-Typestring
Content type.Authorizationstring
Access token generated from create token request.

Attributes

payment_intentstring
Payment intent token.paymentTokenstring
Payment token generated from Create Payment Token request.typestring
Type 1 is ECOM payment and type 2 is MOTO.raw_amountfloat
Payment amount.customer_emailstring
Customer email.customer_namestring
Customer name.customer_addressstring (optional)
User’s address details.customer_postcodestring (optional)
User’s postcode.transaction_uniquestring
Transaction unique.

merchant_data json (optional)
The merchant can add custom key value pairs in JSON format, for example:

Code Block
{
  "my_order_id": 123,
  "fancy_note": "Order complete",
  "card_discount": false
}

Request

Code Block
POST https://secure.blinkpayment.co.uk/api/pay/v1/creditcards HTTP/1.1
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG...

{
    "payment_intent": "pi_Swhc84aSLtUGppvPARX...",
    "paymentToken": "eyJwYXltZW50VG9rZW4iOns...",
    "type": 2,
    "raw_amount": 1.1,
    "customer_email": "random@email.com",
    "customer_name": "A Smith",
    "transaction_unique": "PHnRNzjUw...",
    "merchant_data": "{\"my_order_id\": \"cc-12345678\"}"
}

Response

Code BlockHTTP/1.1 200 OK Content-Type: application/json { "url": "https://api-demo-php.blinkpayment.co.uk/return?transaction_id=BL-MYU12345&status=captured&note=Payment%2BSuccessful&merchant_data=%257B%2522order_id%2522%253A%2522cc-12345678%2522%257D" }

There are two ways to process a credit card:

1. ECOM (which usually requires 3DS)

If ccElement is used then the process is mentioned below.

ECOM payment is the default type and returns an acsform, which is a HTML from used to perform the 3DS authentication.

A HTML page should be send to the user which include the acsform in the body and the following JS in the header:

Code Block
<script>
  onload = () => document.forms[0].submit();
</script>

The user will complete the 3DS form and submit.

After submission, the user will be returned to the predefined return URL with an encoded transaction ID.

If stripeElement is used then the process is mentioned below.

User will create a payment page with the stripeElement. This payment page should follow the below mentioned structure in PHP. After submitting the form user will be redirected to the 3DS server for authentication. On successful authentication, they will be redirected to the return_url, mentioned in Create Intent request, with the transaction details.

Code Block
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        ......
    </head>
    <body>
    .....
    <form id="payment-form" class="payment-form">
       {{ $spElement }}
        <button type="submit" name="stripe"  id="stripe">Pay by Card</button>
        .....
    </form>
    </body>
</html>


2. MOTO (without 3DS).

If ccMotoElement is used, then MOTO payment processes the payment without the 3DS check. Once the payment is processed the user will be returned to the predefined return URL with an url encoded transaction response.

If stripeMotoElement is used, then create a payment page with the following structure in PHP. Once all the payment information is filled in, then call credit card request with all the fields present in stripeMotoElement, to complete the payment process. On successful payment user will get the return_url with encoded payment information as response.

Code Block
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        ....
    </head>
    <body>
    <form id="payment-form" class="payment-form" action="/creditcards" method="POST">
        @csrf
       {{ $stripeMotoElement }}
        <button type="submit" name="stripe"  id="stripe">Pay by Card</button>
    </form>
    </body>
</html>

Anchor
cc-process-ecom
cc-process-ecom

Create Credit Card Payment for ECOM

POST /pay/v1/creditcards

Headers

Content-Typestring
Content type.

Authorizationstring
Access token generated from create token request.

User-Agentstring
User agent.

Acceptstring
Accept

Accept-Encodingstring
Accept encoding.

Accept-Charsetstring
Accept charset.

Attributes (For ccElement)

payment_intentstring
Payment intent token.

paymentTokenstring
Payment token generated from Create Payment Token request.

typestring (optional)
Type 1 is ECOM payment and type 2 is MOTO. Default value is 1 i.e. ECOM.

raw_amountfloat (optional)
Payment amount. If not present, it will fetch value from Intent resource.

customer_emailstring (optional)
Customer email. If not present, it will fetch value from Intent resource.

customer_namestring (optional)
Customer name. If not present, it will fetch value from Intent resource.

customer_addressstring (optional)
User’s address details. If not present, it will fetch value from Intent resource.

customer_postcodestring (optional)
User’s postcode. If not present, it will fetch value from Intent resource.

transaction_uniquestring
Transaction unique.

device_timezoneinteger
Device timezone value which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.

device_capabilitiesstring
Device capabilities which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.

device_accept_languagestring
Device accept language which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.

device_screen_resolutionstring
Device accept language which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.

remote_addressstring
Remote address which can be fetched using javascript and assigned to the respective hosted input field. This value is required in 3DS.

merchant_data json (optional)
The merchant can add custom key value pairs in JSON format, for example:

Code Block
{
  "my_order_id": 123,
  "fancy_note": "Order complete",
  "card_discount": false
}

Request

Code Block
POST https://secure.blinkpayment.co.uk/api/pay/v1/creditcards HTTP/1.1
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG...
User-Agent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
Accept: "*/*"
Accept-Encoding: "gzip, deflate, br"
Accept-Charset: ""

{
    "payment_intent": "pi_Swhc84aSLtUGppvPARX...",
    "paymentToken": "eyJwYXltZW50VG9rZW4iOns...",
    "type": 1,
    "raw_amount": 1.1,
    "customer_email": "random@email.com",
    "customer_name": "A Smith",
    "transaction_unique": "PHnRNzjUw...",
    "device_timezone" : "-330",
    "device_capabilities" : "javascript",
    "device_accept_language" : "en-GB",
    "device_screen_resolution" : "1366x768x24",
    "remote_address" : "123.123.123.123",
    "merchant_data": "{\"my_order_id\": \"cc-12345678\"}"
}

Response

Code Block
HTTP/1.1 200 OK
Content-Type: application/json

{
   "acsform": "<form id="form3ds22" method="post" action="https://acs.********"><input type="hidden" name="creq" value="********">
     <input type="hidden" name="threeDSPageSessions[427**************][bfreq]" value="*******">
     <input type="hidden" name="threeDSPageSessions[427**************][threeDSRef]" value="****">
     <input id="btnSubmit" type="submit" class="button expanded btn btn-primary" value="Process Payment">
     </form>"
}

HTML Page

Code Block
<!DOCTYPE html>
<html>
<head>
  <script>
    onload = () => document.forms[0].submit();
  </script>
</head>

<body>
  <form id="form3ds22" method="post" action="https://acs.********"><input type="hidden" name="creq" value="********">
    <input type="hidden" name="threeDSPageSessions[427**************][bfreq]" value="*******">
    <input type="hidden" name="threeDSPageSessions[427**************][threeDSRef]" value="****">
    <input id="btnSubmit" type="submit" class="button expanded btn btn-primary" value="Process Payment">
  </form>
</body>
</html>

Response

Code Block
HTTP/1.1 200 OK
Content-Type: application/json

{
    "url": "https://demo-app.blinkpayment.co.uk/return?transaction_id=BL-MYU12345&status=captured&note=Payment%2BSuccessful&merchant_data=%257B%2522order_id%2522%253A%2522cc-12345678%2522%257D"
}

Anchor
cc-process-moto
cc-process-moto

Create Credit Card Payment for MOTO

POST /pay/v1/creditcards

Headers

Content-Typestring
Content type.

Authorizationstring
Access token generated from create token request.

Attributes (For ccMotoElement )

payment_intentstring
Payment intent token.

paymentTokenstring
Payment token generated from Create Payment Token request.

typestring (optional)
Type 1 is ECOM payment and type 2 is MOTO. Default value 1 i.e. ECOM

raw_amountfloat (optional)
Payment amount. If not present, it will fetch value from Intent resource.

customer_emailstring (optional)
Customer email. If not present, it will fetch value from Intent resource.

customer_namestring (optional)
Customer name. If not present, it will fetch value from Intent resource.

customer_addressstring (optional)
User’s address details. If not present, it will fetch value from Intent resource.

customer_postcodestring (optional)
User’s postcode. If not present, it will fetch value from Intent resource.

transaction_uniquestring
Transaction unique.

merchant_data json (optional)
The merchant can add custom key value pairs in JSON format, for example:

Code Block
{
  "my_order_id": 123,
  "fancy_note": "Order complete",
  "card_discount": false
}

Attributes (For stripeMotoElement )

merchant_idinteger
Merchant id present in hosted stripeMotoElement.

payment_intentstring
Payment intent present in hosted stripeMotoElement.

resourcestring
Resource value present in hosted stripeMotoElement.

transaction_uniquestring
Transaction unique value present in hosted stripeMotoElement.

stripe_account_idstring
Stripe account value present in hosted stripeMotoElement.

gatewaystring
Gateway value present in hosted stripeMotoElement.

stripe_payment_method_idstring
Stripe payment method value present in hosted stripeMotoElement.

customer_emailstring (optional)
Customer email. If not present, it will fetch value from Intent resource.

customer_namestring (optional)
Customer name. If not present, it will fetch value from Intent resource.

customer_addressstring (optional)
User’s address details. If not present, it will fetch value from Intent resource.

customer_postcodestring (optional)
User’s postcode. If not present, it will fetch value from Intent resource.

Request

Code Block
POST https://secure.blinkpayment.co.uk/api/pay/v1/creditcards HTTP/1.1
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG...

{
    "payment_intent": "pi_Swhc84aSLtUGppvPARX...",
    "paymentToken": "eyJwYXltZW50VG9rZW4iOns...",
    "type": 2,
    "raw_amount": 1.1,
    "customer_email": "random@email.com",
    "customer_name": "A Smith",
    "transaction_unique": "PHnRNzjUw...",
    "merchant_data": "{\"my_order_id\": \"cc-12345678\"}"
}

Response

Code Block
HTTP/1.1 200 OK
Content-Type: application/json

{
    "url": "https://demo-app.blinkpayment.co.uk/return?transaction_id=BL-MYU12345&status=captured&note=Payment%2BSuccessful&merchant_data=%257B%2522order_id%2522%253A%2522cc-12345678%2522%257D"
}

Response codes

Code

Status

Title

Message

Notes

200

Captured

Captured

Payment successful

If a “sale” type payment is successfully processed through credit card, then this status will be returned. Also, if payment type is “credit”, then for successful “credit” type transaction. this status will be returned which credit accepted.

200

Accepted

Accepted

Payment successful and accepted

If payment is captured and received , then this status will be returned

200

Approved

Approved

Payment successful and approved

If a “sale” type payment with delay capture is successfully processed through credit card, then this status will be returned.

200

Reversed

Reversed

Payment successful

If transaction type is “preauth” then for successful preauth transaction this status will be returned.

200

Verified

Verified

Payment successful and verified

If transaction type is “verified” then for successful verified transaction, this status will be returned which means account is valid.

200

Success

Success

Rerun successfully

If rerun request successfully completed then this status will be returned.

200

Success

Success

Captured successfully

If transaction is captured successfully before predefined delay capture duration, then this status is returned.

400

Failed

Validation error

Payment Token is required

If payment token is not present , creditcards request will return this status

400

Failed

Validation error

Device timezone is required

If 3DS authentication is enabled, device timezone is needed for Credit Cards request

400

Failed

Validation error

Device capabilities is required

If 3DS authentication is enabled, device capabilities is needed for Credit Cards request

400

Failed

Validation error

Device screen resolution is required

If 3DS authentication is enabled, device screen resolution is needed for Credit Cards request

400

Failed

Validation error

Device accept language is required

If 3DS authentication is enabled, device accept language is needed for Credit Cards request

400

Failed

Validation error

Remote address is required

If 3DS authentication is enabled, remote address is needed for Credit Cards request

400

Failed

Validation error

Customer name is required

If customer name is not present, this status will be returned

400

Failed

Validation error

Customer email is required

If customer email is not present, this status will be returned

400

Failed

Validation error

Transaction must be in approved state

For Captures Request, transaction must be in approved status

400

Failed

Validation error

Transaction must be preauth type or with delay capture details

For Captures Request, transaction type must be preauth or with delay capture details

400

Failed

Validation error

Amount is required

For Captures Request, if transaction type is “verify”, then amount is required.

500

3DS authentication required

Authentication error

3DS authentication required

If any of the 3DS related details are missing, then this status will be returned

500

Finished

Finished

Missing Cardcvv

If CVV details is not provided during card payment, then this status will be returned

500

Finished

Finished

Authentication Rejected By Issuer - Cardholder Not Enrolled In Service

If 3DS authentication is rejected , then this status will be returned

500

Finished

Finished

3DS declined

If 3DS is declined while authenticating, then this status will be returned

500

Rejected

Rejected

Payment rejected

if after capturing the payment if it’s rejected due to any issue, then this status will be returned