Version: 1.6.3.2

Last Updated:

To use Payanywhere with your website, you have to use android intent hyperlink in your webpage. 
When a user will click on that hyperlink, google chrome will send that intent to android OS and then android OS will transfer that intent to Payanywhere.
And when Payanywhere completes a transaction processing then it will return the transaction result on your mentioned
external notification URL that you have provided during SDK registration.
Please follow the below mention steps to get started: 


How to perform a sale/transaction:


  1. Create a simple web page.  
     
  2. Add following hyperlink on your webpage

    <a href="payanywhere://payment/?chargeAmount=0.27&externalNotification=true&customerTransactionId=12345"> <br />Pay via Payanywhere</a>


    Here “payanywhere://payment/?chargeAmount=0.27&externalNotification=true&customerTransactionId=12345” is the intent uri, and “0.27” is the
    intended charge amount that you would like to process via Payanywhere. “externalNotification=true” is to inform
    Payanywhere that you would like to receive transaction result on your mentioned external notification URL that you have provided earlier. 
    And customerTransactionId=12345 is a unique id for this transaction, provided by you.
    Payanywhere will send this customerTransactionId along with other values on your provided external notification URL for your tracking purpose. 

    **You can also optionally pass another parameter itemName=SomeItemName. This itemName will be used as your sale item name instead of "Express Item".

    When a user will click on this hyperlink, Payanywhere will be started and it will be ready to process a credit card transaction. You can listen for an URL on your server 
    side (which will provide you transaction result based on received transaction result on external notification URL) by an ajax call to get the transaction result.
     

  3. Now plugin a credit card reader into your headphone jack (if required) and do swipe/emv/nfc/keyed a credit card. Payanywhere will handle the processing and will ask for signature.
    Proceed with signature.  If you do not want to see the Signature screen, Turn OFF " Always Require Signature" setting/toggle on Payanywhere App.(Can be download from Google Play Store on any Android or iOS device). If signature is needed on the printed receipt, look at the sections below for Sign On Paper Receipts and how to show Receipt Options screen.

  4. Few other flags can be used like “payanywhere://payment/chargeAmount=2.73&externalNotification=true&customerTransactionId=123456&invoiceNumber=654321"
    For more details have a look into "Example Values/Flags for SDK" table.

  5. In order to have an option to process a CASH transaction include "payanywhere://payment/?chargeAmount=0.01&acceptCash=true".
    This will show an option "Accept Cash Sale" on SDK Payment screen. Once transaction approves,
    if Receipt share is enabled, proceed with sharing or else transaction result will be sent to the client application.
     

  6. When a transaction completed, Payanywhere will send transaction result on your mentioned external notification URL that you have provided earlier.

After an approved/declined transaction, Payanywhere will send result back to external notification URL. External notification will receive following values: 

{
	"status": "APPROVED", (can be either “APPROVED” or “DECLINED”)
    "requested_amount": 20.00 (requested charge amount)
	"amount": 20.00, (authorized charged amount that was applied on this transaction)
	"auth_code": "VI4555", (auth code for this transaction)
	"unique_id": "ccs_23324" (unique id for this transaction provided by PayAnywhere sdk. You can use this unique_id in PayAnywhere system to track your transaction in future)
    "receipt_id": "972145" (payanywhere receipt id.)
    "is_partial_auth": true (A partial auth transaction means when you swipe a card to charge certain amount i.e. $20 but that card has lower amount i.e. $15 than your transaction 
                                 will be partially approved with $15. Example a gift card)
    "extra": {"customerTransactionId": "12345"} (a transaction id provided by you. You can use this customerTransactionId to match between a transaction request that sent by your web app 
                                                     and a transaction response that will be sent to your external notification url)
}


How to perform a recurring payment (**For EPX Customers) (**Important New Changes):


  1. Create a simple web page.  
     
  2. Add following hyperlink on your webpage

    <a href="payanywhere://payment/?chargeAmount=25.00&recurringPeriod=monthss&recurringLength=4&firstName=John&lastName=Kevin&email=johnkevin@gmail.com&externalNotification=true&customerTransactionId=12345">Recurring Payment</a>


    Here “payanywhere://payment/?chargeAmount=25.00&recurringPeriod=monthss&recurringLength=4&firstName=John&lastName=Kevin&email=johnkevin@gmail.com&externalNotification=true&customerTransactionId=12345” is the intent uri.
    When you will execute this code, PayAnywhere will be started and will be ready to process a credit card transaction. 
    Initial sale will be $25.00 and subsequent sales will be every 4 months at $25.00. firstName and lastName and email address are the information of customer who will be enrolling into recuiing payment.
    “externalNotification=true” is to inform PayAnywhere that you would like to receive transaction result on your mentioned external notification URL that you have provided earlier. 
    And customerTransactionId=12345 is a unique id for this transaction, provided by you. PayAnywhere will send this customerTransactionId along with other values on your provided external notification URL for your tracking purpose. 

    In 1.5.6 release, we have added a option to pass "Customer First Name", "Last Name" and "Customer Email Address" into a recurring payment request.
    So our app can use that info and can send email to customer about their enrollment into a auto payments. This changed is due to a requirement by "Visa" Brand. 

    From next release (post 1.5.6 releases), either for every recurring payment request you must need to pass recurring payment customer's firstName, lastName & email. Or you have to make sure to send an email to customer by yourself during a recurring payment if its a VISA.

    **You can also optionally pass another parameter itemName=SomeItemName. This itemName will be used as your sale item name instead of "Express Item".


    When a user will click on this hyperlink, PayAnywhere will be started and it will be ready to process a credit card transaction. You can listen for an URL on your server 
    side (which will provide you transaction result based on received transaction result on external notification URL) by an ajax call to get the transaction result.
     

  3. Now plugin a credit card reader into your headphone jack (if required) and do swipe/emv/nfc/keyed a credit card. PayAnywhere will handle the processing and will ask for signature. Proceed with signature.
     

  4. When a transaction completed, PayAnywhere will send transaction result on your mentioned external notification URL that you have provided earlier.

After an approved/declined transaction, PayAnywhere will send result back to external notification URL. External notification will receive following values: 

{
	"status": "APPROVED", (can be either “APPROVED” or “DECLINED”)
    "requested_amount": 25.00 (requested charge amount)
	"amount": 25.00, (authorized charged amount that was applied on this transaction)
	"auth_code": "VI4555", (auth code for this transaction)
	"unique_id": "ccs_23324" (unique id for this transaction provided by PayAnywhere sdk. 
					You can use this unique_id in PayAnywhere system to track your transaction in future)
    "receipt_id": "972145" (payanywhere receipt id.)
    "is_partial_auth": false 
    "extra": {
			"recurring_payment":{
					"id":123,
					"length":"4",
					"period":"months",
					"amount":25.00,
					"created_date":"09\/08\/2017",
					"last_run":"09\/08\/2017",
					"next_run":"01\/08\/2018"
					}, 
            
			"customerTransactionId": "12345"} (a transaction id provided by you. 
										You can use this customerTransactionId to match between 
										a transaction request that sent by your web app 
              							and a transaction response that will be sent to 
										your external notification url)
}


Every time when our system will perform a recurring payment charge based on the frequency you provided, PayAnywhere will send result back to external notification URL. External notification will receive following values:


{
	"unique_id":"ccs_23324",
	"auth_code":"001777",
	"amount":"25.00",
	"status":"APPROVED",
	"is_partial_auth":false,
	"requested_amount":"25.00",
	"parent_id":"",
	"receipt_id":108740,
	"extra":{
			"recurring_payment":{
					"id":424,
					"length":4,
					"period":"month",
					"amount":25.00,
					"created_date":"09\/08\/2017",
					"last_run":"09\/08\/2017",
					"next_run":"01\/08\/2018"}
					}
}


How to update a recurring payment (**For EPX Customer):

  1. You can update recurring payment frequency i.e. period and length and you can also update credit card sale that will be used for recurring payment.   
    To update the frequency of a  recurring payment just provide recurringPaymentId, recurringLength and recurringPeriod.
    To update a credit card sale that will be used to perform recurring payment you have to pass recurringPaymentId and recurringPaymentCCSId i.e. credit card sale unique id. 
    When credit card sale unique id is passed in, the following happens: The current recurring payment object is deactivated and a
    new recurring payment object is created, pointing to the specified credit card sale object. We will return you the new recurring payment object id.
    Also, to use this field, the credit card sale id must already exist (i.e.: it must have already processed a sale).
    Currently there is no validation that the card is still valid until we attempt a recurring payment charge.
     

  2. Add following hyperlink on your webpage:

    <a href="payanywhere://recurring_payment_update/?recurringPaymentId=1234&recurringPeriod=months&recurringLength=1&recurringPaymentCCSId=ccs_1234&externalNotification=true&customerTransactionId=12345">
    Recurring Payment</a>


    After successful update, PayAnywhere will send result back to external notification URL. External notification will receive following values:

    {
         "id": 25235,  //actual recurring payment id thats updated or new recurring payment id if new recurring payment object created due to new credit card sale unique id
         "updated": true
         "extra": {"customerTransactionId": "12345"}
     }


How to deactivate a recurring payment (**For EPX Customer):

  1. To deactivate  a  recurring payment you have to provide recurringPaymentId..
     

  2. Add following hyperlink on your webpage:

    <a href="payanywhere://recurring_payment_deactivate/?recurringPaymentId=1234&externalNotification=true&customerTransactionId=12345"> Deactivate Recurring Payment</a>


    After successfully deactivate, PayAnywhere will send result back to external notification URL. External notification will receive following values:

    {
         "id": 25235 //recurring payment id thats become deactivated
         "deactivated": true
         "extra": {"customerTransactionId": "12345"}
     }


How to void/refund a transaction:

1. Credit card sales can both be refunded and voided. Credit sale unique id's start with "ccs_".

2. Cash sales can only be refunded. If application tries to send a Void request to SDK for a cash sale, an error message will be thrown. Cash sale unique id's start with "cas_".

For Refund:

<a href="payanywhere://refund/?transactionUniqueId=ccs_50187&receiptId=317748502&refundAmount=0.07&externalNotification=true"> <br />
 <h1>Refund</h1>
</a>

For Void:

<a href="payanywhere://void/?transactionUniqueId=ccs_50187&receiptId=317748502&externalNotification=true"> <br />
 <h1>Void</h1>
</a>



After an approved/declined refund/void request, PayAnywhere will send result back to external notification URL. External notification will receive following values: 

{
     "unique_id": "void_1234", //for refund ccr_1234
     "action": "void", (void or refund)
     "response": "APPROVED", (can be APPROVED, DECLINED etc)
     "status_message": "some approval happened", (Status message i.e. 'invalid refund amount', 'transaction is already refunded' etc)
     "parent_id": "ccs_50187", (actual transaction id that was refunded/voided)
     "receipt_id": "972145" (actual transactions receipt id that was refunded/voided.)

 }


How to perform a Pre Auth transaction:


<a href="payanywhere://preauth/?chargeAmount=0.27&externalNotification=true&customerTransactionId=12345"> <br />
 <h1>PreAuth Via Payanywhere</h1>
</a>


Here “payanywhere://preauth/?chargeAmount=0.27&externalNotification=true&customerTransactionId=12345” is the intent uri, and “0.27” is the
intended PreAuth amount that you would like to process via PayAnywhere. “externalNotification=true” is to inform
PayAnywhere that you would like to receive transaction result on your mentioned external notification URL that you have provided earlier. 
And customerTransactionId=12345 is a unique id for this transaction, provided by you.
PayAnywhere will send this customerTransactionId along with other values on your provided external notification URL for your tracking purpose. 

**You can also optionally pass another parameter itemName=SomeItemName. This itemName will be used as your sale item name instead of "Express Item".

When a user will click on this hyperlink, PayAnywhere will be started and it will be ready to process a PreAuth credit card transaction. You can listen for an URL on your server 
side (which will provide you transaction result based on received transaction result on external notification URL) by an ajax call to get the transaction result.

After an approved/declined transaction, PayAnywhere will send result back to external notification URL. External notification will receive following values: 

{
	"status": "APPROVED", (can be either “APPROVED” or “DECLINED”)
    "requested_amount": 20.00 (requested charge amount)
	"amount": 20.00, (authorized charged amount that was applied on this transaction)
	"auth_code": "VI4555", (auth code for this transaction)
	"unique_id": "pap_23324" (unique id for this transaction provided by PayAnywhere sdk. 
         						You can use this unique_id in PayAnywhere system to track your transaction in future)
    "receipt_id": "972145" (payanywhere receipt id.)
    "extra": {"customerTransactionId": "12345"} (a transaction id provided by you. 
											    You can use this customerTransactionId to match between a transaction request that sent by your web app 
                                                and a transaction response that will be sent to your external notification url)
}


How to Complete a Pre Auth transaction:


<a href="payanywhere://preauth_complete/?transactionUniqueId=pap_23324&receiptId=972145&preAuthCompleteAmount=0.17&externalNotification=true"> <br />
 <h1>Complete PreAuth Transaction</h1>
</a>


After an approved/declined transaction, PayAnywhere will send result back to external notification URL. External notification will receive following values: 

{
	"status": "APPROVED", (can be either “APPROVED” or “DECLINED”)
    "requested_amount": 20.00 (requested charge amount)
    "amount": 20.00, (authorized charged amount that was applied on this transaction)
    "is_partial_auth": true (A partial auth transaction means when you swipe a card to charge certain amount i.e. $20 but that card has lower amount i.e. $15 than your transaction 
                                 will be partially approved with $15. Example a gift card)
	"unique_id": "ccs_23324" (unique id for this transaction provided by PayAnywhere sdk. You can use this unique_id in PayAnywhere system to track your transaction in future)
    "receipt_id": "972145" (payanywhere receipt id.)
    "parent_id": "pap_50187", (actual pre-auth transaction id that was completed)
    "extra": {"customerTransactionId": "12345"} (a transaction id provided by you. You can use this customerTransactionId to match between a transaction request that sent by your web app 
                                                     and a transaction response that will be sent to your external notification url)
}


How to perform a Tips Adjustment:


<a href="payanywhere://tips/?transactionUniqueId=ccs_50187&tipsAmount=0.27&externalNotification=true&customerTransactionId=12345"> <br />
 <h1>Tips Pay via Payanywhere</h1>
</a>


After an approved/declined transaction, PayAnywhere will send result back to external notification URL. External notification will receive following values: 

{
	"status": "APPROVED", (can be either “APPROVED” or “DECLINED”)
    "amount": 0.27, (tips amount)
	"unique_id": "tip_23324" (unique id for this transaction provided by PayAnywhere sdk. You can use this unique_id in PayAnywhere system to track your transaction in future)
    "receipt_id": "972145" (payanywhere receipt id.)
    "parent_id": "ccs_123456", (actual transaction id in which tips was applied)
    "extra": {"customerTransactionId": "12345"} (a transaction id provided by you. You can use this customerTransactionId to match between a transaction request that sent by your web app 
                                                     and a transaction response that will be sent to your external notification url)
}


How to pass primary and contrast/accent color for sales, signature and receipt screen:


  1. With any sdk request you can pass following addional paramter to set primary and accent colors and also can disbale receipt screen.  
    Colors should be in following format rrggbb i.e. 00ff00 or 118855 etc.
    If you dont pass "receiptScree"n paramter then sdk will use sdk "Receipt Option Screen" settings to decide whether to show receipt screen or not.
    If you pass "receiptScreen" sdk paramter then sdk will use both sdk request param "receiptScreen" and sdk "Receipt Option Screen" settings to decide whether to show receipt screen or not. If both true sdk will show Receipt screen otherwise will not.

    private static final String PAYMENT_URL = "payanywhere://payment/";
    private static final int PAYMENT_REQUEST_CODE = 123;
    
    Intent intent = new Intent(Intent.ACTION_VIEW , Uri.parse(PAYMENT_URL +  "?chargeAmount=2.73&externalNotification=true&customerTransactionId=12345&primaryColor=00a6e8&contrastColor=10d625&receiptScreen=false"));
    startActivityForResult(intent, PAYMENT_REQUEST_CODE);






How to request for cancel webhook noticiation when user closes/cancel the sdk from ui close button :


  1. With any sdk request you can pass "cancelNotification" parameter to receive a cancel webhook request on when user closes the sdk by clicking cancel/close ui button.  

    private static final String PAYMENT_URL = "payanywhere://payment/";
    private static final int PAYMENT_REQUEST_CODE = 123;
    
    Intent intent = new Intent(Intent.ACTION_VIEW , Uri.parse(PAYMENT_URL +  "?chargeAmount=2.73&externalNotification=true&customerTransactionId=12345&cancelNotification=true"));
    startActivityForResult(intent, PAYMENT_REQUEST_CODE);


    When "cancelNotification=true" and user closes the sdk, PayAnywhere will send a webhook request to your external notification URL. External notification will receive following values:

    {
         
    	"status": "cancelled", 
        "action_type": "sale", (can be “sale”, “refund”, "void", "tips", "preauth", "preauth_complete", "recurring_payment_update", "recurring_payment_deactivate")
        "extra": {"customerTransactionId": "12345"} (a transaction id provided by you. You can use this customerTransactionId to match between a transaction request that sent by your web app 
                                                         and a transaction response that will be sent to your external notification url)
    }


How to request for auto close sdk after a txn is declined:


  1. With any sdk request you can pass "closeOnDecline" paramter to request sdk to close itself when a transaction is declined.  

    When "closeOnDecline=true" and a txn is declined then sdk will close itself and control will be returned to caller app. 

    private static final String PAYMENT_URL = "payanywhere://payment/";
    private static final int PAYMENT_REQUEST_CODE = 123;
    
    Intent intent = new Intent(Intent.ACTION_VIEW , Uri.parse(PAYMENT_URL +  "?chargeAmount=2.73&externalNotification=true&customerTransactionId=12345&closeOnDecline=true"));
    startActivityForResult(intent, PAYMENT_REQUEST_CODE);


How to request sdk to auto close itself after user inactivity and certain timeout:


  1. With any sdk request you can pass "autoCancelTimeout=seconds" paramter to request sdk to close itself after specified seconds and if user dont interect with sdk during that time.  

    When "autoCancelTimeout=480" sdk will closes itself automatically after 8 mins (i.e. 480 seconds) if user dont do any intereaction by that time. By default autoCancelTimeout is set to 5 mins (300 seconds).
    If user do any intrect i.e. insert/swipe,keyed card or touch then timer will be reset again.

    private static final String PAYMENT_URL = "payanywhere://payment/";
    private static final int PAYMENT_REQUEST_CODE = 123;
    
    Intent intent = new Intent(Intent.ACTION_VIEW , Uri.parse(PAYMENT_URL +  "?chargeAmount=2.73&autoCancelTimeout=480"));
    startActivityForResult(intent, PAYMENT_REQUEST_CODE);



How to Send a Single/Recurring Invoice:

  1. Create a simple web page.  
     
  2. Add following hyperlink on your webpage

    <a href="payanywhere://payment/?chargeAmount=0.27&externalNotification=true&customerTransactionId=12345"> <br />Pay via Payanywhere</a>

    Here “payanywhere://payment/?chargeAmount=0.27&externalNotification=true&customerTransactionId=12345” is the intent uri, and “0.27” is the
    intended charge amount that you would like to send as invoice via PayAnywhere. “externalNotification=true” is to inform
    PayAnywhere that you would like to receive transaction result on your mentioned external notification URL that you have provided earlier. 
    And customerTransactionId=12345 is a unique id for this transaction, provided by you.
    PayAnywhere will send this customerTransactionId along with other values on your provided external notification URL for your tracking purpose. 

    When a user clicks on this hyperlink, PayAnywhere will be started and it will be ready to use. You can listen for an URL on your server 
    side (which will provide you result based on received info on external notification URL) by an ajax call to get the result.

  3. Now select the "Send As Invoice" button under Other Payment Options. Enter all the required fields i.e., Customer First Name, Last Name and Email Address. And select the Due Date. If it is not a one time invoice and want it to be Recurring, toggle "Create Recurring Series" switch. Start Date, End Date and Frequency are Mandatory.  Once all required fields are entered, send button is now Active and once sent and acknowledged takes back to your app. And your customer will receive an email with the invoice receipt created and a Button to pay this invoice.
  4. PayAnywhere will send result on your mentioned external notification URL. External notification will receive following values: 

    {
    	"status": "APPROVED", (can be either “APPROVED” or “DECLINED”)
        "requested_amount": 20.00 (requested charge amount)
    	"amount": 20.00, (authorized charged amount that was applied on this transaction)
        "receipt_id": "972145" (payanywhere receipt id.)
        "extra": {"customerTransactionId": "12345"} (a transaction id provided by you. You can use this customerTransactionId to match between a transaction request that sent by   	your web app and a transaction response that will be sent to your external notification url)
    }

           

How to Add/Receive Customer Name and Contact Info :

  1. With any sdk request you can pass following additional paramter to disbale receipt screen.  
    If you dont pass "receiptScreen" paramter then sdk will use sdk "Receipt Option Screen" settings to decide whether to show receipt screen or not.
    If you pass "receiptScreen" sdk paramter then sdk will use both sdk request param "receiptScreen" and sdk "Receipt Option Screen" settings to decide whether to show receipt screen or not. If both true sdk will show Receipt screen otherwise will not.


    private static final String PAYMENT_URL = "payanywhere://payment/";
    private static final int PAYMENT_REQUEST_CODE = 123;
    
    Intent intent = new Intent(Intent.ACTION_VIEW , Uri.parse(PAYMENT_URL +  "?chargeAmount=2.73&primaryColor=00a6e8&contrastColor=10d625&receiptScreen=false"));
    startActivityForResult(intent, PAYMENT_REQUEST_CODE);

    If receipt screen is shown after a transaction is performed, user can enter Customer First Name, Last Name and also email and phone number to which the receipts can be sent. If account already has Customers saved from our inside.payanywhere.com then those can be chosen by selecting  icon.

How to pass Notes/Comment to SDK:

1. Receipt Notes can be passed to SDK, this notes will be visible on Payment screen, but cannot be edited. If Receipt Options is enabled on SDK, notes will be populated in Receipt Notes field where edits can be done.

2. These notes will be displayed in Transaction Details, which are available on PayAnywhere Inside https://inside.payanywhere.comAlso shown on digital receipts sent from PA.

3. In order to add notes/comments to transactions, following parameter has to be passed in the request.

private static final String PAYMENT_URL = "payanywhere://payment/";
private static final int PAYMENT_REQUEST_CODE = 123;

Intent intent = new Intent(Intent.ACTION_VIEW , Uri.parse(PAYMENT_URL +  "?chargeAmount=2.73&receiptNotes=Hey I am note."));
startActivityForResult(intent, PAYMENT_REQUEST_CODE);



Notes:

** Amount should be always rounded 2 decimal places i.e. 325.67, 42.19, 0.01

** Visit https://inside.payanywhere.com and login with your PayAnywhere credentials to see your transaction details.