Hello I needed to replace an existing payments profile with another and I 
couldn't do it. can you help me.

ERROR

API error with message: '{
"message": "Request contains an invalid argument.",
"code": 3,
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": 
"type.googleapis.com\/google.ads.googleads.v15.errors.GoogleAdsFailure",
"errors": [
{
"errorCode": {
"billingSetupError": "NO_SIGNUP_PERMISSION"
},
"message": "The customer does not have permission to signup for billing or 
does not have permission to use a given payments profile ID."
}
],
}
]
}'.





CODE:
?php
require 'vendor/autoload.php';

use Google\Ads\GoogleAds\Lib\V15\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\Lib\V15\GoogleAdsException;
use Google\Ads\GoogleAds\V15\Resources\BillingSetup;
use Google\Ads\GoogleAds\V15\Resources\BillingSetup\PaymentsAccountInfo;
use Google\Ads\GoogleAds\V15\Services\BillingSetupOperation;

use Google\ApiCore\ApiException;

function createBillingSetup($customerId) {
    $developer_token = 'xxx';
    $client_id = 'xxxxxx';
    $client_secret = 'xxxxx';
    $refresh_token = 'xxxxxx';
    $customer_id = 'xxxxx';
    $manager_customer_id = 'xxxxxx'; // Yönetici müşteri kimliği

    $googleAdsClient = (new GoogleAdsClientBuilder())
        ->withDeveloperToken($developer_token)
        ->withOAuth2Credential(
            (new OAuth2TokenBuilder())
                ->withClientId($client_id)
                ->withClientSecret($client_secret)
                ->withRefreshToken($refresh_token)
                ->build()
        )
        ->withLoginCustomerId($manager_customer_id)
        ->build();

    $start_date_time = date('Y-m-d\TH:i:sP'); // ISO 8601 formatında 
şimdiki zaman

    try {

        $paymentsAccountInfo = new PaymentsAccountInfo([
            'payments_account_name' => 'xxxx',
            'payments_profile_id' => 'xxxx-xxxx-xxxx'
        ]);


        $billingSetup = new BillingSetup([
            'payments_account_info' => $paymentsAccountInfo
        ]);

        $billingSetup->setPaymentsAccountInfo($paymentsAccountInfo);

        $billingSetup->setStartDateTime($start_date_time);

        $billingSetupOperation = new BillingSetupOperation();
        $billingSetupOperation->setCreate($billingSetup);

        $billingSetupServiceClient = 
$googleAdsClient->getBillingSetupServiceClient();
        $response = 
$billingSetupServiceClient->mutateBillingSetup($customer_id, 
$billingSetupOperation);
        printf("Created Billing Setup with resource name: '%s'.\n", 
$response->getResult()->getResourceName());
    } catch (GoogleAdsException $googleAdsException) {
        foreach ($googleAdsException->getGoogleAdsFailure()->getErrors() as 
$error) {
            printf("Error with message: '%s'.\n", $error->getMessage());
        }
    } catch (ApiException $apiException) {
        printf("API error with message: '%s'.\n", 
$apiException->getMessage());
    }
}

// Örnek kullanım:
createBillingSetup('xxxxxxx');
?>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/f61875df-1074-4b46-8159-192673ff2868n%40googlegroups.com.
  • Se... muhammed yalmaç
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to