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.
Duplicate Transaction Handling
In the event that the same credit card is run for the same amount in a 30 minute timeframe, the server will return a flag indicating it is a duplicate. For this scenario the following steps will occur.
- All SDK responses will contain an extra with the key duplicate that will be set to either true or false depending on the response from the server.
- A dialog will be presented indicating that a duplicate transaction was detected and the user will have the option to select Void or Continue.
- In the case of selecting Void:
- A Void will be processed.
- The SDK response will add the extras that begin with duplicateVoid which will contain the transaction response for the Void transaction.
- The SDK response will also contain the extras for the original transaction that was Voided in the normal SDK response extras.
- In the case of selecting Continue, the SDK response will contain the normal extras.
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.