What is the Payment link?
A payment link is a URL or QR code that takes customers to stand-alone web content created in very little time. A customer who clicks on a link is redirected to the checkout page where they will complete the transaction. you'll find a singular link for every good or service you’re selling. One payment link can facilitate a transaction for one intended recipient, like an invoice would, up to an infinite number of shoppers.
Here we are using a Square_up payment gateway to create a payment link with an example of a request and response.
To Payment link, we have to call four APIs.
1- Create Customer API
2- Create Order API
3- Create Invoice API
4 - Publish Invoice API
Let's start with Api's request & response
1- Create Customer API - First of all we have to create a customer, for this, we need an idempotency key(this is auto-generated ) and token id(this is generated into the square_up account)
Request Parameter -
Response of Customer API.
2- Create Order API - In the order API we will create the payment amount as per the above customer purchase request for this we need a customer id (this is generated in the above API response) and the location id (this is generated into the square_up account)
Request parameter -
Response of order API -
3- Create Invoice API - in this API we will create an invoice number for this we need a token id, customer id, location id, and order id. (this all id's will generate in the above api's)
Request parameter -
Response of invoice api -
4- Publish invoice API- here we will find the payment link just by call the public invoice api.
Request
Response parameter -
Finally we will get the payment link - https://squareupsandbox.com/pay-invoice/inv:0-ChBzdE0qKxCgsM0OpIYN7T1IELMK