This function processes a cash or credit-card sale.
Request
Add the following code where you would like to start Payanywhere payment processing (i.e., on button click):
123 is the unique requestCode for this intent. When this code is executed, Payanywhere starts and will be ready to process a credit card transaction. If required, connect a credit-card reader and swipe/EMV/NFC/key the credit card. Payanywhere will handle the processing and ask for a signature. Proceed with the signature.
Additional flags may also be used, such as “payanywhere://payment/chargeAmount=2.73&customerTransactionId=123456&
invoiceNumber=654321&externalNotification=true"
For more information, please refer to the "Example values for SDK" table on the Integration Guide page.
To process a cash transaction, include "payanywhere://payment/?chargeAmount=0.01&acceptCash=true". This will display the option "Accept Cash Sale" on the SDK Payment screen. Once the transaction is approved, if Receipt Share is enabled, proceed with sharing. Otherwise the transaction result will be sent to the client application.
Response
To receive the transaction result on your app, add the following code to your activity:
After the transaction is approved or declined, Payanywhere will send the result to the calling activity with intent extra. The value of “transactionResult” will be one of the following:
- "Approved" when a transaction is approved. You will also receive a “transactionUniqueId”. You can use this unique ID to track your transaction in the future. "recurringPeriod" and "recurringLength" extra will contain the recurring details that you requested. "authorizedAmount" extra contains the authorized charged amount that was applied on this transaction. "authCode" extra contains the authorization code for the transaction.
- "Declined" when a transaction is declined.
- "Cancelled" when a transaction is cancelled.
If a transaction is a partial auth, you will also receive "isPartialAuth" boolean extra. A partial authorization occurs when a lower amount than the transaction amount is authorized on one card, and the remainder of the payment can be processed using another method.