This repository has been archived by the owner on Sep 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
Disable Shipping Adress on Billing Agreements #800
Labels
Comments
I haven't set the shipping address in my code (a.k.a. deleted those lines) and it works perfectly, but then in the confirmation screen you have 2 steps, one is the login and the confirmation, the second is the address, which if the user already have completed the address (s)he just clicks continue.. this is my method: public function createAgreement(
$id_suscripcion,
$nombre,
$descripcion,
$plan_id,
$amount,
$setup_fee,
$tax,
$currency,
&$agreement_id
) {
$now = new Datetime('now');
$now->add(new \DateInterval('PT2M'));
$agreement = new Agreement();
$agreement
->setName($nombre)
->setDescription($descripcion)
->setStartDate($now->format(Datetime::ISO8601));
//Add Plan ID Please note that the plan Id should be only set in this case.
$plan = new Plan();
$plan->setId($plan_id);
$agreement->setPlan($plan);
//Add Payer
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$agreement->setPayer($payer);
//Update URL
$merchantPreferences = new MerchantPreferences();
$merchantPreferences
->setCancelUrl(\Config::APP_DOMAIN . '/suscripciones/' . $id_suscripcion . '/cancel')
->setReturnUrl(\Config::APP_DOMAIN . '/suscripciones/' . $id_suscripcion . '/confirm');
//Add Taxes
if ($tax > 0 && $currency !== null) {
$chargeModel = new ChargeModel();
$chargeModel->setType('TAX')
->setAmount(new Currency(['value' => $amount * $tax, 'currency' => $currency]));
$agreement->addOverrideChargeModel($chargeModel);
if ($setup_fee > 0) {
$merchantPreferences->setSetupFee(
new Currency(['value' => $setup_fee * (1 + $tax), 'currency' => $currency])
);
}
}
$agreement->setOverrideMerchantPreferences($merchantPreferences);
//Create Agreement
try {
//Please note that as the agreement has not yet activated, we wont be receiving the ID just yet.
$agreement = $agreement->create($this->apiContext);
//Get redirect url
//The API response provides the url that you must redirect the buyer to.
//Retrieve the url from the $agreement->getApprovalLink() method
$approvalUrl = $agreement->getApprovalLink();
} catch (Exception $ex) {
$this->log->error($ex->getMessage());
$this->log->error('Exception Code: ' . $ex->getCode());
$this->log->error('Exception Data: ' . $ex->getData());
throw new Exception('error_creating_agreement');
}
return $approvalUrl;
} |
The reason you cannot disable shipping address is because payment experience profile is not yet supported in billing plan. Please refer to this open issue https://github.com/paypal/PayPal-REST-API-issues/issues/4 for tracking purpose. I am going to close this ticket as it's a duplicate. Thanks, Xiaolei |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I want to offer a Premium Membership based on monthly subscriptions and I do not require the adress of the buyer.
In this CreateBillingAgreementWithPayPal example you can set the shipping adress in the agreement. I didn't found a
setNoShipping
function or something similiar.How can I disable shipping for an billing agreement, so the asker won't be asked for it in the checkout dialogue?
The text was updated successfully, but these errors were encountered: