PayPal API - Increase Order Amount after Authorisation. Best Checkout Flow? - php

We are using the PayPal / Braintree API.
What is the correct way of dealing with an increasing order amount (example: delivery costs), after the original order amount has been authorised?
Ideally, we want to send the customer to PayPal once, then they select their preferred delivery on our delivery page, without then sending the customer back to PayPal to ReAuth.
Is this possible?
The delivery amounts can be fairly large, that would take it above the 115% / $75 restrictions.
Thanks.

after the original order amount has been authorised?
Don't do that?
After payment is approved by the payer, but before authorising a transaction, show a review step. Use the selected address to calculate any applicable shipping and tax. Offer a choice of shipping methods if applicable.
When the new total is calculated, and when the user gives final confirmation, create the braintree transaction with the new amount (PayPal payment method in Braintree, or more generally with Braintree). This is analogous to using the non-Braintree PayPal REST API to capture an order with an updated (patched) amount.
One final detail is that since you have a review step after approval, if using the PayPal SDK you should set commit: false (it defaults to true) so that the last button has the correct verbiage indicating there is a further step on returning to your site. With Braintree this looks something like:
paypalCheckoutInstance.loadPayPalSDK({
intent: ????????? , // Braintree defaults this to 'authorize'
currency: 'USD',
commit: false,

Related

WooCommerce - pay order with multiple payment methods at same time

I want to know if there is a way to customize WooCommerce such that the clients could pay the same order with multiple payment methods at the same time?
For example, if one order is worth $100, I want to allow clients to pay $25 with a Visa card, then $75 with a Discover card. So the general idea is to pay one order (don't checkout multiple times), but use more than just one payment method.
I assume there is some way to personalize something, but I want to know where/how to get started with it.
EDIT 1
Just adding a new payment gateway (custom) does not solve the issue. I know how to create a custom payment gateway.
The issue is: how do I allow on ONE checkout for ONE order to get the payment out of 2 or more sources at the same time? For example: $175 cashed in as $50 PayPal + $100 Visa + $25 MasterCard.
There are many clients who would love to have this option, and pay with more cards at the same time!
So, this is not one of those obvious questions as how do I create a custom payment gateway? - that is something easily achievable without spending too much time on it. The multiple payment on same checkout, however, proves to be lengthy / not discussed (I've researched many articles, forums, etc.)
What I would do is to create a custom payment gateway, and in that gateway, create interfaces for ALL the payment methods you want to use.
I would say use something like Stripe for all the CC and then PayPal - that way you will have only two separate ones to handle.
You need to put in an option to pay X amount on each payment gateway on the Checkout screen.
Then in your plugin when someone partially pays, create a coupon for the amount of the partial payment using the Coupon API and apply that.
You will also need an Order Status of Partial Payment or something. You would also need to redirect back to the Checkout page if the order isn't completely paid, instead of the Order Success page.
It's pretty complicated to do this right.
Workaround: You can purchase a gift card on our site for any amount with one credit card. You can then use the gift card and then use another credit card for the balance.
Example: Total price $450
Gift card purchase (Card "A"): $400
Credit Card balance (Card "B"): $50

How to decline a Paypal payment if not from a given residence_country?

We are localizing our website and we want users to be able to pay in USD and EUR, based on their location. Everything is in place, we detect the country based on IP and we choose a currency accordingly. However there is one fraud possibility we haven't tackled yet.
We want prevent our users from paying in USD (the USD price is cheaper) when they are actually in Europe (in case they use a proxy), so I want to use Paypal's residence_country for a double check during or even before payment.
I know I can check the residence_country of the user in the POST data sent to our Paypal IPN notify url. If the country is not the US, I can decline any USD payment by automatically refunding the amount back to the user. Refunding however is not very neat and I noticed that for example Spotify is able to decline a subscription payment before you even pay. So they don't work with refunding. How does this work? How are they able to decline a payment via Paypal before the payment is finished?
It would be nice to be able to pass a country code to Paypal saying "this payment can only be done by a US citizen" but I haven't found such option in the docs here: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
(Yes we use recurring payments for Payments Standard)
Thanks :)
With PayPal RESTful APIs, you obtain a user’s consent to make Identity API calls on their behalf by redirecting them to the authorization endpoint. Once you obtain the authorization, you can request granular user information from PayPal including user's locale and phone_number.
https://developer.paypal.com/docs/api/#get-user-information
This information should be sufficient to establish, which price level applies.
With PayPal Express Checkout API, when you request the token and user data with
GetExpressCheckoutDetails
ask for their
&COUNTRYCODE=
Then, if it does not match the price they selected, do not charge but use DoVoid (it reverses an order or an authorization that a merchant has made with a customer), reset pricing according to the value of &COUNTRYCODE, and request a new token.
(PayPal will drop the payment authorization after about two days on its own. No need to refund anything if you didn't charge.)
See:
https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECGettingStarted/#id0832BC00JY4
(Be warned: when selling to Europeans, you may be required to register for VAT tax in Europe in a country of your choice if you cross a threshold amount of total revenue per year in any one country of the EU. And then the Europeans wonder why they have to pay more. Excessive red tape drives the costs up.)

Magento serial codes

I'm using 'Serial Codes' from 'ModifyMage Solutions' to send serial codes when somebody is buying a product.
Does anybody knows how to send the serial codes ON PAYMENT?
Not on checkout, because that's simple, but ON PAYMENT?
Thanx in advance
You just need to edit your settings. The module can be configured to automatically issue Serial Codes on checkout success, or when an order is invoiced and paid. Source: http://www.modifymage.com/
Here's the important and relevant bits:
Choose to automatically issue Serial Codes based on customer group, checkout success, or when an order is invoiced and paid. Supports the option to create multiple invoices per order.
Automatically assign Serial Codes to deferred payment orders as "Pending" without actually issuing them to the customer until the order is invoiced. Allows for more effective tracking and inventory control. Pending codes are automatically returned to "Available" status if the order is cancelled.
Automatically withhold issuing of Serial Codes for standard Magento deferred payment methods ('Check or Money Order,' 'Cash On Delivery,' 'Bank Transfer') with the ability to notify customers that Serial Codes will be issued upon receipt of payment. Additional deferred payment methods from specific payment modules are also supported.

Is zero amount transaction possible with paypal methods?

Is it possible to do transaction with zero amount in paypal methods like express checkout or standard? I want to do auto payments in paypal express or standard methods. In which is it possible I call request and It will make auto transaction from customer paypal account like it did in Paypal recurring method. I do not want to use paypal recurring method because I am managing my own payment schedules and do not want to use its default recurring system.
I am using autorize.net CIM method also. which is working fine right now and I am calling payment request and its doing payment. I also want to do zero amount transaction in that case.
can any one help on this point?
NO,
You need to bypass to zero value.
Means Just do all thing proper except real payment. i.e. order entry, shipping etc. just in it your transaction id is not available.
It sounds like you want to be able to charge the buyer later down the road, instead of charging them immediately -- is that right?
If so, then you need to use Billing Agreements and Reference Transactions. See https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/integration-guide/ECReferenceTxns/ for more information.
Note that you will need to get approval from PayPal before you can start creating billing agreements.

Proper way to create dynamic automatic billing method with paypal API?

I know this maybe a duplicate but due to the overwhelming amount of paypal APIs I am having a hard time finding a GOOD answer to my question.
I need to create variable monthly billing per user in PHP. The idea is that a user could sell a number of items with a total sum of sales at the end of the month p. So the billing would be something of the extent MY_PERCENTAGE_FEE * p. The user would then be sent an invoice, and a would be automatically billed via paypal for that amount.
Now, it would be SUPER great if this could be done by creating reoccurring billing and updating the amount at the end of the month. Is that possible? If not what would be the next best way to go?
If you're creating recurring profiles with Payments Pro you can adjust those without any limits. Unfortunately, with Express Checkout you're limited to raising the amount by only 20% every 180 days, so that doesn't normally work out very well. You have a few options of how to get around that.
1) Utilize billing agreements with Express Checkout and Reference Transactions. This would allow you to run an authorization (or an original sale of some sort) for a payer and then from that point on you can use that transaction ID from the original transaction along with a new amount in the DoReferenceTransaction API. Reference Transactions area available with Payments Pro by default, but if you want to use them with Express Checkout you'll need to get that specifically enabled on your account.
2) Use the Preapproval API, which is part of the Adaptive Payments platform. This is similar to reference transactions except that you can create preapproved rules by which you can bill your payers at any time without further approval. This would allow you to process payments for them at any time you need to and pull variable amounts accordingly.
3) Use the Pay API, which is also part of Adaptive Payments, with a split payment (parallel or chained) which would allow you to take your cut in real-time without the need to track balances and submit variable recurring payments. Each time one of your customers is paid for their product/service, you would immediately be paid your share.

Categories