简体   繁体   中英

Stripe customer management on android using ephemeral keys and volley

I am trying to achieve this on stripe (as shown in the image) on the android SDK . 在此处输入图片说明 I have already created an endpoint on my server which returns the ephemeral key in this format

{
    "id": "ephkey_EPHEMERAL_KEY_HERE",
    "object": "ephemeral_key",
    "associated_objects": [
        {
            "id": "cus_CUSTOMER_ID_HERE",
            "type": "customer"
        }
    ],
    "created": 1535352558,
    "expires": 1535356158,
    "livemode": true,
    "secret": "ek_live_SECRET_HERE"
}

The stripe documentation here https://stripe.com/docs/mobile/android/standard is however not very clear on how to go about this on the android platform and I am totally lost and confused. I am using volley library for networking on the app. Any pointers on how to go about it?

You need to create a class that implements EphemeralKeyProvider which will communicate with your backend to get the key. Example here .

You then use that class to instantiate a CustomerSession ( example ), and finally create a PaymentSession ( example ), which will use the CustomerSession you created to interact with the Stripe API(via the ephemeral key) to manage the customer's payment sources.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM