question

qualwebs avatar image
qualwebs asked David Marginian Deactivated commented

Save card for customer using API

We have successfully integrated single time payment using below APIshttps://docs.clover.com/reference/tokens
https://docs.clover.com/reference/chargesWe are able to generate APIKEY and access-token to generate card token and create a charge, But having issues with creating a customer with card details for future payment.We are following this(https://docs.clover.com/reference/customers) guide to creating a customer with card details and using the same access token But in customer's API endpoint access token not working, although the same token working for charges API.We have granted all permission required from the developer account, still having issues with that, It always returns, Your OAuth2 token is incorrect or has expired.Please let us know if any other information is required.

Payments
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

Have you seen the warning at the bottom of the page here:

https://docs.clover.com/docs/ecommerce-generating-a-card-token

Using the iframe and API integration to securely accept credit card information reduces the PCI compliance burden on app developers and on Clover merchants.
For using the API only integration in production, you must have (or use a service that has) a PCI DSS certification.

You are not permitted to be using the /tokens endpoint unless you have PCI DSS certification.

That being said, your token is likely missing permissions. If you have changed the permissions on your APP after it has been installed you need to uninstall the app, re-install it and obtain a new token (instructions for doing this can be found here - https://community.clover.com/articles/23744/resolving-401-unauthorized-responses-when-making-a.html).

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.

qualwebs avatar image qualwebs commented ·

Hi,

We already enabled customer and payment in API scope, Also we are able to run charges API successfully.

But the create customer and save card is not working. Here is the URL which we are following
https://docs.clover.com/docs/ecommerce-saving-card

It always returns

{

"message": "401 Unauthorized"

}

Also, This is a web application based on REST API and all API scope and oAuth token generated on sandbox mode.

This charges endpoint working fine for one-time payment with generated card token.

                    
  1. https://scl-sandbox.dev.clover.com/v1/charges

Also, regarding iframe, How it will work on custom mobile applications? Do you have mobile SDKs?

Thanks for you help in advance.


Best,

Dev

qualwebs

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ qualwebs commented ·

A 401 means either your token is invalid or it doesn't have the required permissions for the API call you are making. The permissions required for Ecomm endpoints are documented here - https://docs.clover.com/docs/ecommerce-app-permissions. To save a card on file your app will need to request Read customers, Write customers and Online payments.

Once you properly set the permissions for your app you will need to follow my instructions in my previous response:

If you have changed the permissions on your APP after it has been installed you need to uninstall the app, re-install it and obtain a new token (instructions for doing this can be found here - https://community.clover.com/articles/23744/resolving-401-unauthorized-responses-when-making-a.html).


0 Likes 0 ·
qualwebs avatar image qualwebs David Marginian ♦♦ commented ·

Thank for reply David!

Actually we have REST Client web app and yes we already added Read customers, Write customers and Online payments in scope and generated a fresh token on sandbox.

If you want I can share the sandbox app ID with you.


Best,

Dev

qualwebs

0 Likes 0 ·
Show more comments
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