Versions Compared

Key

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

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=14&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:

      Code Block
      languagejson
      {
      	"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:

      Code Block
      languagejson
      {
      	"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:

      Code Block
      languagejson
      {
        "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:

      Code Block
      languagejson
      {
        "orderId": "fdfQQ33gdgWfgGoP642"
      }

Lucidchart
pageCount2
autoUpdatetrue
alignleft
typerich
autoSize1
macroId66d1b398-8bfd-4ce7-9a0c-14e109d81131
pages1
instanceIdConfluence:5730988163
width700
documentId186fe06e-5923-413c-ba59-75dc2f035cfe
documentToken186fe06e-5923-413c-ba59-75dc2f035cfe|158359129|45744133|7omTZeg1HE6/DoBR3+Yn1gyNqDAvdzEWwZhM2HYo34Q=
updated1632754736382
height500