Jump to content

TUTORIAL – Shopify Payment Gateway PART 2 - XRP-Shopify Payment Sync


TOCACoffee

Recommended Posts

You may have seen our other post here about how to add XRP as a new payment gateway on Shopify.

Now we have a solution to automatically sync any payments received to your XRP wallet with your Shopify account!

 

Login to Shopify and on the left hand side select Apps:

Apps.jpg.9647c24b6469f5aba9f9e16d6366f388.jpg

 

At the bottom of the page click the Manage private apps link:

PrivateApps.jpg.792d176cf9e08916aa19f97431f7d77d.jpg

 

At the top right hand corner of the next page click Create a new private app:

CreateNewPrivateApp.jpg.eea17f86009e4322dce05220deb33ccb.jpg

 

Fill out the following form and you can set everything to No access except for Orders, transactions and fulfillments which needs to be Read and write, then click Save at the top:

CreatePrivateApp.thumb.jpg.3ae42540aa61bd64c895c21deaa7c4d1.jpg

 

You will be prompted with a confirmation screen confirming the sensitivity of the credentials you are about to generate and not to share them with anyone:

CreatePrivateAppConfirmation.jpg.3edcf33d9faf42b69ad92ed204e498b0.jpg

 

On the following page you will be presented with your API credentials:

KeyData.thumb.jpg.e53e162b14aa8404206d64f6ba1f46a6.jpg

 

Open the XRP-Shopify Payment Sync Access Database and enter in your API Key, API Password, Shopify Store Name and XRP Wallet Address. The USD Issuer Exchange is used during the exchange rate process to identify the proper XRP/USD exchange rate via the Ripple APIs, it is currently set to use Bitstamp. Allowable Difference is the USD amount you are willing to accept as a difference between what the customer sends to you in XRP and what it converts to in USD. 

If the USD amount received is higher than the total order price, the program will simply mark the order as paid in full. (You can either check your wallet or view the processed orders via the Processed Orders button to confirm dollar amounts.)

If the USD amount received is less than the total order price but is within your allowable difference amount (which should be set as a negative), then the program will mark the order as paid in full.

If the USD amount received is less than the total order price and is not within the allowable difference amount, then the program will mark the order partially paid and update it accordingly in Shopify.

 

The program will run every 5 minutes once you click Run, and the button will change to Stop upon clicking. You can leave it running in the background should you so desire. 

The program will connect to Shopify, obtain any orders that were processed using the gateway name XRP and that are pending payment.

The program then connects to your XRP wallet and downloads the last 50 transactions.

It then obtains the current exchange rates and calculates the difference between USD and XRP.

A query matches any orders from Shopify to your XRP wallet based on the destination tag.

Next based on the matching orders and calculations it will update Shopify accordingly either marking it as paid or partially paid.

Last it will save all the processed orders to a table which can be accessed via the Processed Orders button. 

 

XRPShopifyPaymentSync.jpg.e3ddff1f5c382cae9c268068fdc10209.jpg

 

In the background this uses:

A curl command line executable (should be in the same directory as this database)

VBA-JSON available from https://github.com/VBA-tools/VBA-JSON

ShellWait by Terry Kreft

 

I have uploaded everything to GitHub and it is accessible at https://github.com/TOCACoffee/XRP_Shopify_Payment_Sync

 

I tried to make it so that even if you do not have Access, you could download the MS Access Run Time from Microsoft and still run the database to get the job done. However I am attaching the full database that you are free to modify for your own needs.

 

Our hope is that this will help more people start offering XRP as a payment option which will help increase awareness, usage, and price!! 

If this tutorial has helped you and you'd like to donate ( rTocauxk75yWyEhwo5QxHGwytweG7JXYD ) or if you'd like to experience some amazing coffee from our tocacoffee.com website, use code XRPChat and save 35% on your purchase!

In conjunction with this post we are also launching a new blend available via this link called Moon Lambo:

 Moon Lambo - TOCA Coffee

Description:

When Moon? When Lambo? Now! No FOMO or FUD here and your ROI is immediate with this blend of the best the blockchain has to offer. Resist the urge to HODL these top Americas, Asia and Africa coffees and enjoy.

Medium Roast

 

 

Link to comment
Share on other sites

Cancel Feature Added

Since customers may select XRP and not pay, we don't want to have pending orders just sitting in the Shopify queue. We entered a cancel time field on the menu and after, for example, 15 minutes has passed since the order was entered, the program will automatically cancel the order and send notification to the customer that the order has been canceled. This change has been added to GitHub at https://github.com/TOCACoffee/XRP_Shopify_Payment_Sync If you don't wan't this feature, simply download the original version from GitHub.

 

XRPShopifyPaymentSync-Update.jpg.2f5ddba55e62bd6302e6c6b88b2b1c50.jpg

Link to comment
Share on other sites

Just updated the cancel feature to first void the transaction and then cancel the order.

Also if you are interested in changing the email the customer receives after canceling an order for non-payment within Shopify, go to Settings then Notifications and click Order canceled, then enter the following text where highlighted below:

    {% when 'declined' %}
 {% if order.transactions[0].gateway == "XRP" %}    
     Order {{ name }} was canceled because no XRP payment has been received
 {% endif %}

CanceledXRPEmail.thumb.jpg.72d2ffd78b11eec87f729ccc625a63a2.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...