AuthorizeNet / sample-code-php

This repository contains working code samples which demonstrate php integration with the Authorize.Net API
MIT License
176 stars 197 forks source link

createCustomerProfileTransaction sample code request #61

Closed rmckeel closed 7 years ago

rmckeel commented 7 years ago

Thank you for your hard work on this sample PHP code library!

There is a function createCustomerProfileTransaction used in the SDK-PHP test suite. However, I am not seeing the function createCustomerProfileTransaction used anywhere in this sample-code-php library.

Would you be able to add a sample that included this function?

Thank you for considering,

Ryan

rmckeel commented 7 years ago

I noticed this sample code, but I don't know the library well enough to know if that is the same as a transaction like AnetAPI\CreateCustomerProfileTransactionRequest.

ashtru commented 7 years ago

If you have a customer profile, it is okay to charge the customer profile using the charge customer profile sample code.

The only important thing is to make sure a valid payment profile id is assigned, as seen on line 18.

The SDK PHP Suite example you saw is an older method of requesting from the SDK, but is deprecated now. You won't see the shipping address field, as in the old code in charge-customer-profile sample.

ashtru commented 7 years ago

I looked at the CustomerProfilePaymentType class. So, for setting the shipping profile in the charge customer profile sample code, you would need to add a line like this: $profileToCharge->setShippingProfileId($shippingProfileId);

Feel free to reach out in case of queries.

rmckeel commented 7 years ago

@ashtru Thanks for your review of this. Good to know about the deprecated code, glad my 'hunch' was correct in using the sample code and not the test code. Hope the tests can be updated to reflect (and prevent others from being confused).

Thanks for your hard work on this library! I will close this out now.

brianmc commented 7 years ago

Hi Ryan,

That's a deprecated method, you can now use the standard createTransaction to charge a profile: http://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-customer-profile

Brian

Sent from my iPhone

On Dec 14, 2016, at 2:35 PM, Ryan McKeel notifications@github.com wrote:

I noticed this sample code, but I don't know the library well enough to know if that is the same as a transaction like AnetAPI\CreateCustomerProfileTransactionRequest.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.