Home > Net >  Flutter - How to remove Shipping Information & Create your PayPal account from check out?
Flutter - How to remove Shipping Information & Create your PayPal account from check out?

Time:12-02

I am creating an app where the user pays a one-time fee to start using the app for lifetime. I am using flutter_paypal with the following:

...
builder: (BuildContext context) => UsePaypal(
    sandboxMode: true,
    clientId: "clientIdHere",
    secretKey: "secretKeyHere",
    returnURL: "successUrl",
    cancelURL: "cancelUrl",
    transactions: const [
      {
        "amount": {
          "total": '13.00',
          "currency": "USD",
          "details": {
            "subtotal": '13.00',
            "shipping": '0',
            "shipping_discount": 0
          }
        },
        "description": "Some description.",
      },
    ],
    note: "Some note.",
    onSuccess: (Map params) async {
      print("onSuccess");
    },
    one rror: (error) {
      print("onErros");
    },
    onCancel: (params) {
      print("onCances");
    }
),
...

Everything is working fine. I want the user to pay with card via PayPal, but it shows sign in to PayPal and then continues the payment.

And if the user clicks on the Create an Account option which is below the Sign In button, it shows the pay with card option but it also forces the user to enter the shipping address and enter personal information to create the account, and both are required.

How I can force PayPal to show only the pay-by-card option, without showing the shipping information form and creating an account form?

My app has nothing to do with the shipping information, it's just a one-time payment. How to remove the shipping information form and create an account form?

CodePudding user response:

That package uses the older v1/payments API: https://github.com/Mixpeal/flutter_paypal/blob/main/lib/src/PaypalServices.dart#L51

It is documented here: https://developer.paypal.com/docs/api/payments/v1/#payment_create

You can set application_context.shipping_preference to NO_SHIPPING for none to be part of the transaction record.

--

However, regardless of whether the transaction involves shipping, a billing address is still used/collected as part of any PayPal checkout, be it with an account or as a guest.

Whether a guest payment (without creating an account) is possible or not is decided by PayPal for each checkout attempt, and depends on very many factors -- including the IP address and geographic location of the payer. If an account is required, a payer without one must enter in a password to create one as part of sending the payment.

  • Related