Token payment: Difference between revisions

From Barion Documentation
Jump to navigation Jump to search
Line 16: Line 16:
One of the properties is the <code>InitiateRecurrence</code> property. This is a bool property, if you set it to '''true''' then the payment gateway will consider the request as a token registration. This happens even if the customer is already has a registered token, so you are able to re-register a customer.  
One of the properties is the <code>InitiateRecurrence</code> property. This is a bool property, if you set it to '''true''' then the payment gateway will consider the request as a token registration. This happens even if the customer is already has a registered token, so you are able to re-register a customer.  


The other required property for a token registration is the token itself, specified in the <code>RecurrenceId</code>
The other required property for a token registration is the token itself. This is generated by the shop and has to be unique for every registration. The token should be specified in the <code>RecurrenceId</code> property of the [[Payment-Start-v2|Payment/Start]] request.


=== Exmaple JSON request ===
=== Exmaple JSON request ===
Line 49: Line 49:
}
}
</source>
</source>
The response to this is almsost the same as to a [[Responsive_web_payment#Processing_the_successful_response|basic '''Immediate''' scenario]]. The only difference is that there is the <code>RecurrenceResult</code> property that tells the result of the token registration. This could be either
* '''Successful''': the token is registered and live, can be used for payment
* '''Failed''': the token registration was not successful, the token can not be used
* '''None''': this could only happen if no token payment was requested
=== Possible error responses ===
{| class="wikitable api-table"
! Error code || Description
|-
| RecurringPaymentNotAllowed || The token payment is not allowed for the shop identified by the '''POSKey'''. Contact Barion to request this feature.
|-
|}


== Using the token ==
== Using the token ==


TODO
TODO

Revision as of 09:36, 10 February 2017

Token Payment

This payment scenario allows the integrator shop to register a customer (and a funding source) in the Barion system and then later on charge the customer without redirecting it to the Barion system. This means that the customer authorizes the shop to charge its card without typing in the card information again.

The payment process

The process is divided to two major steps:

  1. Creating the token that represents the one of the customer's funding source (credit card or e-money wallet)
  2. Using the registered token to charge the customer

Creating the token

To be able to use a token payment scenario first we have to register the token with Barion. The token registration is basically a normal payment with two new properties in the Payment/Start request. This means that we have to make sure that the customer is well aware of the fact that he or she is giving consent to a tokenized payment. The Barion pamyment does not indicate in any way that the payment is a token payment.

One of the properties is the InitiateRecurrence property. This is a bool property, if you set it to true then the payment gateway will consider the request as a token registration. This happens even if the customer is already has a registered token, so you are able to re-register a customer.

The other required property for a token registration is the token itself. This is generated by the shop and has to be unique for every registration. The token should be specified in the RecurrenceId property of the Payment/Start request.

Exmaple JSON request

{
    "POSKey": "E31EC263-01DC-40BD-BDF1-38FC7A332434",
    "PaymentType": "Immediate",
    "PaymentRequestId": "EXMPLSHOP-PM-001",
    "InitiateRecurrence": true,
    "RecurrenceId": "SHOP-XMLP-TOKEN-ABC-123",
    "FundingSources": ["All"],
    "Currency": "EUR",
    "Transactions": [
        {
            "POSTransactionId": "EXMPLSHOP-PM-001/TR001",
            "Payee": "[email protected]",
            "Total": 25.2,
            "Comment": "Subsription fee for the first month",
            "Items": [
                {
                    "Name": "Website subscription",
                    "Description": "Website subscription for one month",
                    "Quantity": 1,
                    "Unit": "month",
                    "UnitPrice": 25.2,
                    "ItemTotal": 25.2,
                    "SKU": "EXMPLSHOP/SKU/PHC-01"
                }
            ]
        }
    ]
}

The response to this is almsost the same as to a basic Immediate scenario. The only difference is that there is the RecurrenceResult property that tells the result of the token registration. This could be either

  • Successful: the token is registered and live, can be used for payment
  • Failed: the token registration was not successful, the token can not be used
  • None: this could only happen if no token payment was requested

Possible error responses

Error code Description
RecurringPaymentNotAllowed The token payment is not allowed for the shop identified by the POSKey. Contact Barion to request this feature.

Using the token

TODO