Purchase Access flow

To use our API for PurchaseAccess you need to authenticate and have a special permission to use. See our Authentication document for instructions on how authentication works.

This API is a REST service. Further documentation can be found at api.pei.is.

Example usage of the purchase access service:

  1. Checking the access to a buyer

    1. Returns a boolean of whether the merchant with the ID has access to purchasing order for the buyer with that SSN.

    2. GET /api/purchaseaccess?merchantId=4&buyerSsn=1234567890

    3. Example output: 

      false

  2. If new recurring Pei customer then create and confirm purchase access

    1. Requesting purchase access to a buyer

    2. Send a PIN to a buyer in a text message to be used to confirm the purchase access later

    3. POST /api/purchaseaccess/request

    4. Example POST body:

      { "merchantId" : 4, "buyerSsn" : "1234567890", "mobileNumber" : "1234567" }
  3. Confirming purchase access for a buyer

    1. Using a PIN from the buyer, confirm purchase access

    2. POST /api/purchaseaccess

    3. Example post body:

      { "merchantId" : 4, "buyerSsn" : "1234567890", "pin" : "000000" }
  4. Recurring Pei customer

    1. Now that the merchant has access to the buyer, construct a PurchaseAccessOrderForm and use this service to purchase orders for the buyer

    2. POST /api/orders/pay

    3. Example post body:

      { "merchantId": 4, "buyer": { "name": "Jack Johnson", "ssn": "1234567890", "email": "example@example.com", "mobileNumber": "1234567" }, "amount": 15000, "reference": "REF155", "postbackUrl": "http://www.msn.com/", "items": [ { "code": "SUB555", "name": "TV subscription", "quantity": 1, "unit": "stk.", "unitPrice": 5000, "amount": 5000 }, { "code": "SNOW99", "name": "Snow", "quantity": 20000, "unit": "stk.", "unitPrice": 0.5, "amount": 10000 } ] }
    4. Example output: