Latest News: (loading..)
greasemonkey

Apple Pay - who's up for a challenge

16 posts in this topic

As noted in this thread http://forums.oscommerce.com/topic/410486-big-switch-to-mobile-users/?fromsearch=1

 

Most of us store owners have seen a massive shift to mobile in the last 12 to 18 months. This was probably expected for most of us... however the challenge to optimize our sites to this new environment is on going. Not just in "display" but also in things like payment options.

 

Our site as an example now receive more than 50% of traffic from mobile - even more if you include tablet. Of which 47% is on IOS (add another 15% if you include tablet).

 

Tapping into Apples built in payment system (Apple Pay) seems like a logical next step to optimize our stores.

 

The bad news.... it's well beyond my skill level to understand how to do this....

 

The good news... Etsy, a huge (eBay "like") North America Ecom company, has released its Apple Pay code open source.

 

https://codeascraft.com/2015/11/20/crunching-apple-pay-tokens-in-php/

 

This "call to action" is for other store owners like me... who have enough knowledge to be dangerous.... to get together and; 1) either figure out how to make a payment module OR 2) put together our penny's and pay one of the fine coders here to do it for us.

 

Who's interested... in option 1 or option 2.

Share this post


Link to post
Share on other sites

@@greasemonkey

 

Apple Pay needs to be integrated through a payment gateway such as Authorize.net, Braintree, Stripe etc.

 

You can't make a standalone Apple Pay payment module.

 

Oh, and it only works in Safari browsers.

Edited by frankl

Share this post


Link to post
Share on other sites

How to integrate Apple Pay best, based on this information from https://developer.apple.com/apple-pay/get-started/ ?

 

Do not require registration before the purchase.
Apple Pay provides an excellent opportunity to offer Guest Checkout to your users. Customers are less likely to abandon the purchase experience when there is as little friction as possible. After completing the purchase, you can make it easy for the customer to create an account by pre-populating a registration form with the information you received from the payment.

Share this post


Link to post
Share on other sites

There is a new Braintree Module (aka App) in the works (for 2.4), it includes "ApplePayCard module"...

Share this post


Link to post
Share on other sites

As Frank mentioned it is also available through Authorize.net. Your processor will also need to support it.  They seem to have an API for it so there is likely some development work to do too.

 

Dan

Share this post


Link to post
Share on other sites

I just wanted to add a bit to this thread.

 

I have implemented Apple Pay on my osC site and it works well. I used stripe for my integration as it was the least headache inducing of the options I found.

 

I would share code but my integration is extremely customized for my shop. Basically it consists of the following:

 

A new payment module that outputs on the cart page.

a page in the ext/modules/payment folder to handle call backs

The stripe PHP API code

 

Most of the code can be found on the stripe website but of course implementing the various aspects of the code has to be done by you (shipping modules, order totals, etc...)

 

I'm glad to answer any questions you have about the integration. It makes checking out extremely streamlined and simple!

Share this post


Link to post
Share on other sites

@tmcca

On 5/15/2017 at 1:14 PM, mattjt83 said:

A new payment module that outputs on the cart page.

a page in the ext/modules/payment folder to handle call backs

The stripe PHP API code

You can use the guidelines I listed above as to what you will need to code up. If you have something started I would be glad to give you pointers if I can.

I'm not sharing my code because it is very customized for my particular setup and would only cause confusion.

Share this post


Link to post
Share on other sites

@mattjt83

Only thing so far I have done is the admin side like this in stripe.php: I know I have to add $content which I think need to add this:

document.getElementById('apple-pay-button').addEventListener('click', beginApplePay);
'MODULE_PAYMENT_STRIPE_APPLEPAY' => array('title' => 'Enable Apple Pay',
                                                                'desc' => 'Enable Apple Pay in store.',
                                                                'value' => 'False'),
                                                                'set_func' => 'tep_cfg_select_option(array(\'True\', \'False\'), '),

Now looking at docs on stripe it says need to do the following:

<style>
  #apple-pay-button {
    display: none;
    background-color: black;
    background-image: -webkit-named-image(apple-pay-logo-white);
    background-size: 100% 100%;
    background-origin: content-box;
    background-repeat: no-repeat;
    width: 100%;
    height: 44px;
    padding: 10px 0;
    border-radius: 10px;
  }
</style>
<button id="apple-pay-button"></button>

That I put  in my css file: now Stripe says after setting publishable key in stripe.php I added it after:

Stripe.setPublishableKey('{$stripe_publishable_key}');
Stripe.applePay.checkAvailability(function(available) {
  if (available) {
    document.getElementById('apple-pay-button').style.display = 'block';
  }
});

Not sure where or how to add this:

function beginApplePay() {
  var paymentRequest = ...; // see above

  var session = Stripe.applePay.buildSession(paymentRequest,
    function(result, completion) {

    $.post('/charges', { token: result.token.id }).done(function() {
      completion(ApplePaySession.STATUS_SUCCESS);
      // You can now redirect the user to a receipt page, etc.
      window.location.href = '/success.html';
    }).fail(function() {
      completion(ApplePaySession.STATUS_FAILURE);
    });

  }, function(error) {
    console.log(error.message);
  });

  session.oncancel = function() {
    console.log("User hit the cancel button in the payment window");
  };

  session.begin();
}

 

Edited by tmcca

Share this post


Link to post
Share on other sites

@tmcca

Take a look at how the paypal express module works. You need to output a button on the cart page for apple pay. That button will be generated via the payment module that you code. When the user clicks that button your page will make call backs to the apple pay module that you placed in your /ext folder like I outlined. 

It get's pretty in depth. If it's way above your pay grade it might be advisable to ask in the commercial support forum. 

Again, if you come up with some code on your own I would be glad to try and help you troubleshoot things. In my first post I outlined at minimum what you will need to code up.

Share this post


Link to post
Share on other sites
17 hours ago, tmcca said:

@burt that braintree module in works is that on github?

I don't know.

Share this post


Link to post
Share on other sites

The feature seems to be still deployed for some users, but most testers with iOS 11.2 beta 2 installed should be able to access the service. Here is a guide on how to use apple pay:
 

Share this post


Link to post
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