cancel
Showing results for 
Search instead for 
Did you mean: 

How to set createProfile using PHP API

Most of my questions have been answered but I can't seem to get this to work.

I can run a successful transaction and add customer billing info, but I can't get it to create a profile for me.

 

In a previous post I was told to set createProfile=true. I am trying to do that like so:

$this->custpaymentprofile = new AnetAPI\CustomerProfilePaymentType();
$this->custpaymentprofile->setCreateProfile(true);

 

How do I send custpaymentprofile to the transaction?

Example: $this->transactionRequestType->setBillTo($this->billto);

 How do I send the createProfile info?

 

Thanks,

 

- D

fifty-git
Regular Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

I'm not sure in your code sample here exactly what $this is referring to. In our sample code, we generally have a transactionRequestType object that is simply named $transactionRequestType. In order to add the flag to create a profile to one of our samples, you would need to add this code:

 

$profile = new AnetAPI\CustomerProfilePaymentType();
$profile->setCreateProfile(true); 
$transactionRequestType->setProfile($profile);

View solution in original post

Trevor
Administrator Administrator
Administrator
3 REPLIES 3

I'm not sure in your code sample here exactly what $this is referring to. In our sample code, we generally have a transactionRequestType object that is simply named $transactionRequestType. In order to add the flag to create a profile to one of our samples, you would need to add this code:

 

$profile = new AnetAPI\CustomerProfilePaymentType();
$profile->setCreateProfile(true); 
$transactionRequestType->setProfile($profile);
Trevor
Administrator Administrator
Administrator

Thanks, this is what I was looking for:

$transactionRequestType->setProfile($profile)

 

Thanks,

 

- D

fifty-git
Regular Contributor

Hi, I've an implementation for PHP, for some reason when trying to instantiate a new class of CustomerProfilePaymentType it's throwing a class not found exception, can you please give me some advice? I've checked and everything seems to be fine there: sdk-php/lib/net/authorize/api/contract/v1/