Apple Pay. Workflow - java

I don't clearly understand - how Apple Pay works in case of online checkout via online store.
From my understanding:
Prerequisites:
1) Card which will be used for payment should be added to Passbook.
2) During adding this card to passbook Apple device sends request with PAN to issuer and if verification is passed - format unique token, which is stored in AppleSecurity element.
When customer try to make purchase online via online store: 1) customer should switch the card, which will be used for payment 2) Store formats the request with total amount, shipping address and token, which is stored on Security element 3) Apple device sends request to AppleServer for payment authorization 4) After this store can executes additional logic (whatever)
Feel free to correct me if I'm wrong.
But my question is - if existing system already uses tokenization service, payment gateway and payment processor - how it can be integrated with Apple Pay?

You need to look at the documentation on Apple. Your description of the way apple pay works is correct in the first part, and incorrect in the second part. There's a good tutorial on Apple Pay at Ray Wenderlich.com that shows how to implement it.
Here's a general description:
Within an app, Apple Pay is just a source for payment details. The app is responsible for
creating a payment request (with line items and a total)
triggering the apple pay interface
checking any shipping details
contacting the back end or a service (Stripe, etc) to create a token for the specific purchase
sending the successful purchase token to the app's server to record the purchase
So there are two tokens needed: one for the user's payment details (the card) and a second token for the actual purchase. In loose terms, Apple Pay is responsible for generating the first one, but the app + some service is responsible for generating the second one.

Related

Can't read Google Pay Pass event card through another phone's NFC reader

I need to make an app that is able to read the Google Pay Pass event ticket through NFC. But I can't find any way how to deal with it. I saw some top apps in Google Play, as PassWallet and Passes, which works with such event tickets.
But they all could add a new ticket through scanning barcode only, not through NFC touch. I tried to open a ticket in Google Pay app and read it through another phone's NFC reader but didn't receive any information about the ticket, I always receive my default credit card info even when I open needed card.
So my question is that is it possible to read Google Pay Pass event ticket through another phone's NFC, as in the picture below?
If yes, could you share with me some example codes on how to do it?
Yes it is possible.
For a Google Pay issued pass the pass must be saved to google pay on the mobile device and that passes class must be set to enable smart tap and the pass itself must have the smartTapRedemptionValue field set as below:
{
...
"smartTapRedemptionValue": "Value to Transmit",
...
}
The device acting as the terminal (reads the pass) must implement the Smart Tap Protocol and present the collector id, and signed payload to the mobile device to authenticate the terminal and send passes that it can redeem.
The passes class also has the field redemptionIssuers can specify which terminal's collector id can redeem it.
In order to implement Smart Tap Protocol you can request access to the NDA protected docs via a form and that has the details on how to configure a device acting as a terminal to read passes.
There are also already certified supported terminal providers available.

How do you detect if a user's existing subscription's price has changed (Google Play in-app purchase)?

Google has documentation of what to do IF a subscription's price has changed.
You're supposed to use a billing client and launch PriceChangeConfirmationFlow. However, how do you detect if the price has changed in the first place?
What Android library API would tell me that?
The SkuDetails have the price, but the Purchase details don't. They just refer to the SkuDetails using the "productId". I'm looking at the raw json. If the Purchase object had a price in it, I could compare it to the current price in the SkuDetails, but it doesn't.
When you query for the user inventory with the billing API, you get Purchase objects which include the purchase time. A bit of a hacky solution is to look at that date and if it's before the time you changed your price, you initiate the flow with launchPriceChangeConfirmationFlow().

Send an email (or any message) once and only once inside a retryable operation

I have a program that is charging a user's credit card. The card is charged via a 3rd party API. When I get a response from the 3rd party API, I update the internal representation of the user's balance. Once the user's balance is updated a receipt is sent to the user via email.
There is a small chance that some server error (e.g. unexpected power outage) could occur between charging a user's card and updating the internal representation of their balance. To protect against this, I've made the entire payment process idempotent so it can be retried without double charging the user but will definitely update the user's internal balance. The only issue is with sending the receipt. There is no way (that I can think of) to make this operation idempotent. Currently, I'm sending an email only of the balance update actually changes anything, but of course the server could fail between the balance update and sending the receipt, leading to a situation where the receipt will never be sent. How do people typically address this problem?
I've marked this question as language-agnostic because it seems to be a general problem with sending messages, but I'm using Java and AWS's Simple Email Service for this so it would be great to get answers using those technologies.
When we have done this before, We used a flag in the object that was set when the notification was sent so that the loop wouldnt send the email if the flag had been set for that transaction/id

Paypal java API app between users

I have a question regarding the Paypal Java API. I read their documentation and watched some tutorials about their developer tool to integrate Paypal in my app, but I didn't see nothing about letting users pay each other through Paypal.
To be more explicit, for 2 users, user provides a service through the app for user 2 and user 2 now has to pay user 1 through Paypal within the app. Is it possible, and if it is, how ?
From what I read, the only way I can think about doing this, Paypal API can send an invoice to user 2, but from me (from the application as the receiver) and so the money would go to the app account (express account or whatever it was called) and from there I could forward the money to the user 1. This way would be really inefficient and I wonder if I could make the transaction directly: user 1 sends an invoice to user 2 and user 2 pays that invoice directly.
Thank you.
You can use Adaptive payment API to let user 1 pay user 2 directly, the app act as the API caller, please see document here

Android In-App billing - some cards not accepted

I get a lot emails lately that someone tried to pay inside my application with in-app billing and they get a "card not supported" kind of error on the Android in-app billing window. These same people report that they are able to buy other apps directly on Android Market, and with the same card they can't pay in-app.
I tried to contact Google but no response yet (I will post an update if I get an answer).
Have you experienced something similar? And then some people run into the in-app billing bug, where your order is "pending" and you can't do anything. I get negative feedback and this is outside my responsibility.
I think I found a solution for my problem. It was most probably caused after we asked Google to transfer the whole Android account to a new gmail address. I have checked the in-app products in the Android Market console and the the price field was empty on the new account! Only the country specific prices were set. I am pretty sure that the price was set before the account was changed. So I edited the product and entered a price and I asked a customer who previously couldn't pay to try it again. It worked!
So be sure to check if your in-app products have the price set (and not only the country specific price values).
BTW. Google also changed our public key while switching the accounts. People were complaining the whole day that they paid and didn't receive the item. Well Google took the money but the information was delivered signed with a new public key and was not recognized on the devices.

Categories