Rest Api: Sale method

The sale method is considered the most important of the rest API because it is in charge of requesting the payment to the clients and verifying the status of the transaction. The execution flow of the method is as follows:

  1. POST call for request payment: As we saw in the PayPhone operation The customer confirms their consumption from their mobile device thanks to a request of the establishment; The sale method helps us create this application. By means of a POST call we indicate to the service of PayPhone the attributes of the transaction like the telephone number of the client, the value, the taxes, among others. All the monetary values to be sent must be multiplied by 100, for example, $1 dollar = 100; $1.50 dollars = 150. Enter the swagger and you'll be able to see his consultation and response model. Always remember to send the fields according to your type of billing; AmountWithTax and Tax in case of charging VAT or AmountWithoutTax in case of being 0% rate. Note: Here you can see how to use the swagger.  
  2. Check transaction status: After the execution of the previous call PayPhone will give you a transaction identifier (TransactionID) with which you can check the status of the payment made (pending, accepted or cancelled). For this you must make a GET call to the PayPhone service sending as parameter the TransactionID. Here's the query and response model.

PayPhone will give you a code in the "statusCode" field corresponding to the transaction status: 1-Pending, 2-cancelled and 3-approved.

You can create a routine so that every certain time your platform consults to PayPhone the status of the transaction and according to the response you show the client the result.

From now on you have two identifiers for your transaction, a TransactionID delivered by PayPhone and a clientTransactionID that you provide in the first POST call. For anull, check, reverse or cancellation calls you can use either the TransactionID or your clientTransactionID.

Note: The StoreID field is only sent when different stores or branches are handled, if different stores are not used it can be omitted. To Specify which store does the collection the storeID is obtained from the Website of PayPhone Developer, in the Company request section, Actions column, List of stores.

You can check the catalogue of errors by clicking Here.

Leave A Comment?