Create a Payment

Endpoints

HTTP Method API URL API Version
POST https://paiement.payzone.ma/transaction/prepare >= 002
POST https://paiement.payzone.ma/payment/prepare >= 002.50

This call corresponds to the step 2 of the global workflow. It is used to initialize a payment with all the required data (excepting payment mean information). The information for the payment are serialized in JSON format and are transmitted in the body of the request.


Accepted parameters


Notes :
  • 3DSecure V2 is available at version 002.70
  • While testing your 3DSv2 implementation, you can set the parameter shopper.account.suspicious as true to trigger a challenge. false should result in frictionless flow.
  • In the case of a non subscription creation payment, paymentMode may only take Single or OnShipping as a value.
  • In the case of a subscription creation payment:
    • If the merchant is allowed to do on the fly subscription, subscription details can be specified in the On the fly Subscription fields (don’t use offerID in this case)
    • If the merchant is not allowed to do on the fly subscription or wants to use a predefined offer, the offerID field allows to choose the subscription to initiate
    • paymentMode may only take Recurrent or InstalmentsPayments

The API calls are all authenticated using the standard Basic HTTP Authentication mechanism with the credentials provided at the subscription to the service.


Payment Methods and Networks

Some payment methods can have several networks. Adding the payment network parameter in the API call will make the application create a payment with the chosen payment network. Not providing the network field for multi-networks payment methods will generate an error.


Payment Method Payment Network Description
CreditCard   CreditCard

Response

The body of the response to a transaction creation request is in JSON format.

The following fields are present in the response :


Name Type Description API Version
code String(3) API response code (see response codes for possible values) >= 002
message String(128) Human readable message associated with the code >= 002
customerToken String The customer token to be used for payment processing (only present if payment creation was successful) >= 002
merchantToken String(32) The merchant token to be used for payment status request (only present if payment creation was successful) >= 002

Response codes

Here are the possible response code to a payment creation:


Response code Response Message
200 Request processed successfully
400 Missing parameter
401 Missing parameter in request
402 Error during JSON deserialization of parameter
500 Error handling the request
501 Incorrect data in submitted request


{
    "code": "200",
    "message": "Request processed successfully",
    "customerToken": "1234",
    "merchantToken": "1234"
}
        

Code samples


© Payzone | 2023