question

brokenoval avatar image
brokenoval asked David Marginian Deactivated commented

How to generate a multi-pay token with the Ecomm i-frame?

How can I request a multi-pay token from the iFrame?


I understand there is a separate flow for using the /customers API, but we maintain a database of customers for the merchant and the database is centralised for multiple locations (aka UUIDs aka merchants). So what I'd prefer to do is just store the customer's token after a single tokenization action for use in the future by the same customer (merchant initiated, subsequent charges).


I've spotted the documentation as mentioned here: https://docs.clover.com/clover-platform/docs/ecommerce-saving-card but what I'd like to do is send up a parameter in the iFrame and have the token returned as a multi-pay token - is this possible?



EDIT:
I've figured out how to initiate the multi-pay token from the iframe, for reference, it just requires sending the following from the frontend:

const clover = new Clover ( payment . publicToken )
await clover . createToken ({ isMultipayToken: true }). then (( result ) => { // do stuff })


However, that brings me to my next question. When sending subsequent payment requests via the API and setting the `stored credentials` along with the rest of the body for the /v1/charges API like this:

body:

{
    "amount": 300,
    "currency": "eur",
    "source": "clv_1TSTSTB3Rd4SNUUUgDDjP2rp",
    "description": "Merchant Name",
    "ecomind": "moto",
    "stored_credentials": {
        "sequence": "SUBSEQUENT",
        "initiator": "MERCHANT",
        "is_scheduled": false
    }
}

The charge is successful, but I get the following warning message:


"warning_message": "Subsequent credential on file pay request sent for without Initial credential on file pay request.",

I presume I need to store and send the initial payment ID with subsequent requests. However I'm not sure which value to store ("ref_num" or "auth_code") and what to label it as when I send up subsequent requests? (presumably another value in the "stored_credentials" object?)


EDIT 2:

OK so I've figured out how to get the subsequent payments working after getting a multipay token from the iFrame as follows:
First request (customer initiated):

{
    "amount": 100,
    "currency": "eur",
    "source": "clv_1TSTSTB3Rd4SNUUUgDDjP2rp",
    "description": "Merchant Name",
    "ecomind": "ecom",
    "stored_credentials": {
        "sequence": "FIRST",
        "initiator": "CARDHOLDER",
        "is_scheduled": false,
    }
}


This returns a ref_num value in the response that needs to be stored and sent as part of a "recurring" payment in subsequent requests as follows:

{
    "amount": 200,
    "currency": "eur",
    "source": "clv_1TSTSTB3Rd4SNUUUgDDjP2rp",
    "description": "Merchant Name",
    "ecomind": "moto",
    "stored_credentials": {
        "sequence": "SUBSEQUENT",
        "initiator": "MERCHANT",
        "is_scheduled": true,
        "installment_info": {
            "bill_pay_indicator": "Recurring",
            "invoice_number": {ref_num from initial transaction response}
        }
    }
}


So now that I have everything working as expected, most of this is undocumented, so my question is, are you going to remove this or can I use it with confidence in production?

Thanks and sorry for the runaround.

e-commerce api
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated commented

No, that is not possible. The current flow is outlined in the link you mentioned, that is the only option. I suspect things are this way not to inconvenience you but to be compliant (I am not an expert here). Customers need to consent to you storing their card and we try to convey that via the additional call to the customer's api.

6 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brokenoval avatar image brokenoval commented ·
Thanks David - I just left an edit on my question and managed to get the process working as desired, however subsequent messages are marked with a warning. We're fairly used to the general process of tokenising and informing the customer and marking the payments appropriately for the issuers, so I just believe I'm missing the key for the API that describes the initial payment identifier used in the first tokenization charge
0 Likes 0 ·
brokenoval avatar image brokenoval brokenoval commented ·
Added 2nd edit
0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ brokenoval commented ·
Ok, I really need to run this by the ecomm team ... I will let you know when I hear back.
0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community