Jump to content

API - AddPayMethod is broken


onehat

Recommended Posts

Hello.

I want to be able to add pay methods through the API, but the functionality seems to be broken.

I can successfully use AddPayMethod through both the localAPI and also the external API.
 

$command = 'AddPayMethod';
$data = [
	'clientid' => 490,
	'type' => 'RemoteCreditCard',
	'gateway_name' => 'stripe',
	'card_number' => '4111111111111111',
	'card_expiry' => '0320',
	'set_as_default' => '1',
];


//	{
//		result: "success",
//		clientid: 490,
//		paymethodid: 52
//	}

The pay method then appears in the database in tblpaymethods, albeit with wrong payment_type and no gateway_name.

tblpaymethods.thumb.png.547e763adf27b3b12d10943ae2ffdc90.png

 

HOWEVER, then calling GetPayMethod retrieves no results:

$command = 'GetPayMethods';
$data = [
	'clientid' => 490,
];


//	{
//		result: "success",
//		clientid: 490,
//		paymethods: [ ]
//	}

And there are no pay methods in the WHMCS dashboard for this client.

dsahboard.png.fe8c844d32c19902a15f688658d07740.png

NOTE: I have tried this with all kinds of permutations of real credit card numbers (rather than the test cc#, shown above), and also using type: 'CrediCard' and no gateway_name. The results are always the same. The API says, result: 'success', and it saves it to the DB table, but GetPayMethods never returns anything, and the actual WHMCS dashboard shows no pay methods for that client. If I manually add a PayMethod via the WHMCS dashboard, then that will appear in the results for GetPayMethods.

How am I supposed to add a PayMethod via API?

Thank you,
Scott

 
Link to comment
Share on other sites

  • 11 months later...
On 2/27/2020 at 8:25 PM, onehat said:

To anyone else who reads this in the future, WHMCS has confirmed to us that this part of the API is broken. They suggested that we open a feature request for the API to support Stripe payments thru the API. Dead end.

We are facing same issue, Did you open feature request?

Link to comment
Share on other sites

  • 1 month later...
  • WHMCS Support Manager

Hi all,

Unfortunately it won't be possible to pass the credit card details to Stripe via the API; this means that the Stripe-hosted Elements forms cannot be used. Sending the card details via the API mean they touch your server, requiring a different Stripe API with increased PCI compliance requirements.

Clients must use the payment forms in the UI to pass the details via the Stripe Element fields.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated