How do I purchase a label with Shippo via the Stripe integration? - shippo

I'm looking to integrate Shippo with Stripe to get shipping rates for my shop, and I want to purchase the label through Shippo.
Getting the rate from Shippo via the Stripe API is fine, then I make a call for the Rate using the object_id from the Stripe results.
But when I try to purchase the label through the Transaction request on from Shippo API, it says that it's rejected because it's a QUOTE, not a PURCHASE rate.
Here's the error message: "The given Rate can't be purchased because it's object_purpose is not PURCHASE."
How do I convert the Rate from a QUOTE to PURCHASE?

Right now you can't convert a Rate from QUOTE to PURCHASE on Shippo, so you'll have to create a shipping label through Shippo with the single-call label creation process. You can pass in the carrier and service level tokens that you got from the Rate response to get what you need.
See the full Shippo label generating example with Stripe. Here are the snippets you'll want to note:
# create Label with one API call - carrier_account, and servicelevel_token taken from the rate response.
transaction = shippo.Transaction.create(
shipment = shipment,
carrier_account = rate.carrier_account,
servicelevel_token = rate.servicelevel_token

Related

How to set up a PayPal monthly payment with varying amounts

I'm currently building a Flutter application with an unusual subscription model. The idea is that depending on how the user uses the app, they would seamlessly be charged a different amount of money each month. I plan to use PayPal, and I've looked into their REST API, this is what I found: https://developer.paypal.com/docs/api/payments.billing-agreements/v1/#definition-agreement_details
In this API endpoint, I'm assuming I can setup a Billing Agreement for each user of a specific amount_range, where once the user agrees to the payment, I'd be allowed to seamlessly charge each user a varying amount, within that range.
Am I correct in my conclusion?
Would this be the best approach?
if not, can you point me in the right direction for how to achieve what I'm trying to do?
I do not want to use the deprecated API. it's very important to be using REST API.
Thank you very much.
The Billing Agreement API you link to is deprecated.
Using the current PayPal Subscriptions, if you create a unique Plan for each subscriber, you can update that Plan > 10 days before their next billing date, and they will receive an email notification of the new amount.
You can use webhooks to keep track of active subscriptions and the last time you've been successfully paid for one.
If you need an internal ID for reconciliation, set the parameter custom_id when you first create the subscription; its value will be returned in webhook events for that subscription.

How can i capture more then autorized amount

On the PayPal developer site they state it is possible to capture 75 US Dollar or 15% percent more than the original authorized amount of a payment. I am currently using the order API because I can't seem to figure out how to create a Payment from the payment API. My question is the following: how can I capture a different amount then the authorized amount(order API). In the capture section of the Order API I can't give up a new amount. I tried to patch the order first but after the amount was authorized the status of the order is COMPLETED, so the value couldn't be updated.
I think the reason I don't understand how to do it is because I don't know the difference between Order and Payment API. I would like to use the payment API but I can not find an PayPal API to create a payment.
Use the order API with "intent":"authorize". The completed order will have a payment authorization object in the response.
Use the payment API to capture the authorization object for the desired amount, https://developer.paypal.com/docs/api/payments/v2/#authorizations_capture

change product quantity in payment request API

can we change the product quantity if we use the payment request API?
as for now, i see example of changing the payment method, changing user contact information, changing shipping address and also selecting various type of shipping address but i don't found an example that shows buyer can change quantity of the item
for example the buyer click buy now, and then that Payment Request API interface would popup. In the popup, i want the buyer to be able to add quantity of the item he or she want to buy.
That is not possible within the Payment Request API spec.
If you want to make it happen, consider proposing the feature in the spec discussion at https://github.com/w3c/payment-request/issues .

Process magnetic stripe data through PayPal API

Is it possible to process an authorization/payment through PayPal's API using the card magnetic stripe data rather than populating number and other fields? I'm aware that I can parse the track data and supply the fields they are requesting, but that is still processed as a card-not-present/eCommerce payment with a higher fee than if the payment was processed with the track data.
PayPal does have a POS API that allows you to send track data over to PayPal so it's treated as card-present, however, you don't get the lower fee. PayPal does. You still pay the 1.9 - 2.9 that you qualify for based on your volume.
Also, that API is only open to a few PayPal Partners. If you're an official PayPal Partner let me know and I can get you some more details.

Is a payments callback URL required with Facebook local currency flow?

While implementing and testing local currency payment flow for my app I got an error with the pay dialog.
error_code = 1383044
error_message = "no callback url"
I have been reading the How-To at https://developers.facebook.com/docs/howtos/payments/ and the impression I got was that the payments callback was optional. However this error message seems to imply that it is required. Is setting up a payments callback a must for local currency payments?
(also, as a side question, are real time updates different from the payments callback? https://developers.facebook.com/docs/howtos/payments/fulfillment/#rtu)
No, the payments callback URL is not required, as long as you are using static pricing. Dynamic pricing does require the payments callback.
It turns out that I had a bug in my Open Graph object template that caused Facebook's Open Graph parser to not recognize the price data for the product I was testing. Since there was no price data, Facebook treated the item as a dynamically priced item. (https://developers.facebook.com/docs/howtos/payments/definingproducts/#pricing_dynamic)