Problem or Bug - creating or editing a TargetCpa Bidding with TargetCpaBiddingScheme()

48 views
Skip to first unread message

Valentin

unread,
Sep 14, 2015, 3:38:43 PM9/14/15
to AdWords API Forum
Hey,

I have a problem creating or editing a TargetCpa Bidding strategy (TargetCpaBiddingScheme) with the Adwords PHP libary v201506.

We're using the following code:

$biddingStrategyService =$user->GetService('BiddingStrategyService', ADWORDS_VERSION);

$sharedBiddingStrategy
= new SharedBiddingStrategy();
$sharedBiddingStrategy
->status = 'ENABLED';
$sharedBiddingStrategy
->name = 'example strategy name';
 
$biddingScheme
= new TargetCpaBiddingScheme();
$biddingScheme
->targetCpa = new money('100');
$sharedBiddingStrategy
->biddingScheme = $biddingScheme;

$operation
= new BiddingStrategyOperation();

$operation
->operator = 'ADD';
$operation
->operand = $sharedBiddingStrategy;
 
$result
= $biddingStrategyService->mutate(array($operation));
$newBiddingStrategy
= $result->value[0];



Here is what the API returns: [RequestError.UNKNOWN @ operations[0].operand.biddingScheme.targetCpa] 

However, if I remove the line $biddingScheme->targetCpa = new money('100'); from the example above it says:  [RequiredError.REQUIRED @ operations[0].operand.biddingScheme.targetCpa]

That doesn't make sense to me. Whats wrong with that line? Or is that a bug in the PHP library or even worse the Adwords API itself?

Any help appreciated! 

Thanks in advance,

Valentin

Anthony Madrigal

unread,
Sep 14, 2015, 4:22:31 PM9/14/15
to AdWords API Forum
Hey Valentin, 

For any object of type Money in AdWords API, you will need to set the microAmount. You were getting an error since your microAmount of 100 is invalid. $1.00 is equivalent to 1,000,000 micro units, so please use a valid amount.

If you are still facing issues after modifying this, please let me know.

Regards,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages