Posts

Showing posts from February, 2016

Accepting payments with Stripe in APEX, Part 3

Image
Hooking everything up in APEX In part 1 of the series, we set up a form that would accept payment information. In part 2 we set up a PL/SQL API. Now, the final step is that we want to actually charge the card after the user submits the payment information, which is relatively straight forward. First, we can set up a couple of substitution strings for our stripe secret and the wallet information Next, add a new (hidden) item to the page that we can set the token into it (I called mine "P1_PMT_TOKEN"). Once that is on the page, we can modify our existing dynamic action (from part 1), so the code now looks like: var handler = StripeCheckout.configure({ key: 'pk_test_oXgwgmJbBmhzODwHxoKE8zAz', locale: 'auto', token: function(token) { $s('P1_PMT_TOKEN', token.id); } }); handler.open({ name: 'Demo Site', description: '2 widgets', currency: "aud", amount: 2000 }); Now, after the

Accepting payments with Stripe in APEX, Part 2

Image
Adding the PL/SQL API In the previous part of this series, we hooked up the payment form so that users can enter their credit card information to accept payment. After this, the next thing you need to do is to charge the user for the goods or services. In the payment form, it's all on the client side using JavaScript; This time, we need to make some requests in PL/SQL. There is no client libraries for PL/SQL, so we need to set up some to make requests to the Stripe API. All the Stripe API's have the base URL: https://api.stripe.com/ - so we first need to set up an ACL. Just whilst figuring everything out, we will assign this to the schema you are developing out of (down the track, when we switch to APEX_WEB_SERVICE, we can also assign the ACL to the APEX schema). DECLARE l_filename varchar2(30) := 'stripe.com.xml'; l_schema varchar2(20) := '[SCHEMA?]'; BEGIN BEGIN DBMS_NETWORK_ACL_ADMIN.DROP_ACL( acl => l_filename

Accepting payments with Stripe in APEX, Part 1

Image
I've just been investigating a payment gateway for an APEX application. I already knew about the recent startup Stripe, and their fees seemed just as good (if not better) than the other well-known contenders - I figured there would be a good place to start. Now, I haven't actually worked with the others, but so far, I'm very impressed with the system/API available. From my little bit of research, all the card information will be stored on Stripe's servers, so we need not deal with storing and encrypting customers card information. With that, we are left with this general workflow: Include a form for customers to enter there card information The form gets submitted to Stripe's servers Returned is a token. We use this to then complete the charge For this first part, I'll be focusing on the form. In particular, Stripe provides a form for us that we can re-use. Check out the documentation on the form here -  https://stripe.com/docs/tutorials/checkout . K