delay of Paypal API disbursement for transactions with a range of money values

After browsing through various resources such as this link, that link, and another one on the PayPal developer website, I attempted to implement a payment processing system that allows users to approve a preset amount of money. Similar to services like Uber, where the total charge is calculated and deducted automatically after completion.

However, I'm facing difficulty in achieving this functionality using the PayPal API. It seems that the API only supports processing orders with set amounts approved by the user. How can I enable automatic deduction of variable amounts from users upon completion of a service?

Answer №1

To initiate a v2/orders payment, use intent: 'AUTHORIZE',. Once the buyer approves the order, make an API call to authorize it. Then, when it's time to disburse your variable amount (which may be less), initiate another API call to capture that amount.

Below are the three server-side API calls you need:

  1. https://developer.paypal.com/docs/api/orders/v2/#orders_create
  2. https://developer.paypal.com/docs/api/orders/v2/#orders_authorize
  3. https://developer.paypal.com/docs/api/orders/v2/#orders_capture

Additionally, here is a demo pattern of the client-side UI required for the initial two steps: https://developer.paypal.com/demo/checkout/#/pattern/server

(During the second fetch() XHR, ensure you're authorizing instead of capturing immediately to include this additional step before proceeding with the capture process.)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unusual Behavior Observed in JavaScript Map Reduce

var t = [-12, 57, 22, 12, -120, -3]; t.map(Math.abs).reduce(function(current, previousResult) { return Math.min(current, previousResult); }); // returns 3 t.map(Math.abs).reduce(Math.min); // returns NaN I'm puzzled as to why the second variant ...

What is the best way to transfer parameters from the Vue root to a component?

Currently, I am attempting to transfer a string value from index.cshtml to the main Vue element. The specific parameter I want to pass is: userId Location: Index.cshtml (this is where the parameter is obtained) @using Microsoft.AspNetCore.Identity @inje ...

Rotate image in Vue3 using @click

I have a dashboard with a refresh button that I want to rotate 360 degrees every time it is clicked. How can I achieve this rotation effect on the image with each click of the refresh button? Below is the code snippet I have been working on, but it only r ...

Is it possible to retrieve the client's IP address within an Express.js API?

I am currently working on building a chat application using node.js as the backend. Each client will have a unique IP address, so I need to find a way to retrieve the IP addresses of the clients through my API. ...

Ever since updating my Node JS, the functionality of the MaterializeCSS carousel methods has ceased to work

Recently, I encountered some issues with my React project that features a materialize-css carousel. The problem arose after updating my nodeJS version from 14.8.1 to 16.13.0. Specifically, these errors kept popping up: TypeError: Cannot read properties o ...

Uninterrupted text streaming with dynamic content that seamlessly transitions without any gaps

I'm currently facing a challenge with an outdated element like <marquee>. Here's a fiddle where you can check it out: https://jsfiddle.net/qbqz0kay/1/ This is just one of the many attempts I've made, and I'm struggling with two m ...

Using Handlebars JS to incorporate HTML tags such as <li>, <br>, and more in your data

Is there a way to use handlebars to display a list of data in an unordered format, with "title" and "articles" as the main categories? The issue arises when some of the articles contain HTML tags, such as <a> for links. In my current code, instead of ...

Turn off auto-suggestion feature on the iPad and iPhone keyboard using JavaScript

I'm facing a challenge where I want to turn off the predictive suggestions and autocorrect feature on the iPad keyboard. This image is just for display purposes and not from my actual project. I need to hide the highlighted suggestion bar, and I am u ...

Troubleshooting: MongoDB Date Aggregation Problem

My MongoDB query is designed to retrieve records based on specific criteria, but I suspect there may be an issue with how the aggregation pipeline is working. While the query is mostly accurate in fetching the relevant records, it seems that certain entrie ...

Exploring the seamless integration of Material UI slider with chart js

Looking for guidance on syncing Material UI slider with chart js? I'm working on a line chart and hoping to have the x-axis value highlighted with tooltip as I slide the Material UI slider. ...

ajax-jquery request declined

I have a jquery-ajax function that is being called multiple times with different IP addresses each time. This function makes a call to an action in the mvc4 controller responsible for executing a ping and returning the results. After analyzing the request ...

Is there a way to confirm the presence of multiple attributes in a JSON format using JavaScript?

Currently, I am developing a module that processes multiple complex JSON files and requires a method to notify users if certain elements are missing. Although the current approach works, I can't shake the feeling that there must be a more efficient a ...

transmitting a socket ID from one user to another for establishing a connection

Is it possible to pass a parameter to io.on(); that can be utilized as the socket.id during connection instead of the automatically generated socket id? If so, can this be achieved using var socket=io(); ? var app = require('express')(); var htt ...

Trouble with AngularJS: Updates not reflecting when adding new items to an Array

I am facing a persistent issue that I have been unable to resolve, despite researching similar problems on StackOverflow. My current project involves building an application with the MEAN stack. However, I am encountering difficulties when trying to dynam ...

What is the best way to handle multiple promises when loading a state in Angular?

When loading the /home state, I need to retrieve all users from the database in order to customize the home controller and view based on the logged-in user. Currently, in the :resolve section of the state configuration, I am fetching all 'posts' ...

Leveraging JavaScript variables conditionally within a JSON object

Within the code snippet below, there is a condition written as (if (epsflag==0)<?php $a=",hide:'true'";?> ). I am looking to achieve the same condition using JavaScript. Essentially, I want to conditionally utilize a JavaScript variable in ...

Dropdown menu not populating with options in AngularJS ngOptions

It's puzzling to me why the dropdown menu is not being populated by ng-options. Despite JSON data being returned from the service and successfully logged in the controller, ng-options seems to be failing at its task. <tr class="info"> <td ...

Downgrading the node version on a Mac continues to display the previously installed version

I am currently in the process of downgrading my node version on a Mac terminal. sudo npm cache clean -f sudo npm install -g n sudo n 9.10.0 After executing the above commands, I checked the version and it remained the same as the previous version. npm - ...

Tips for keeping data on a page up-to-date using Node.js and Express

Currently delving into the world of Node.js and Express, I am immersed in a project that involves pinging websites and exhibiting the results on a web page. Leveraging HoganJS for templating as well. My primary focus is to decipher the steps necessary to m ...

What is the best method to retrieve the raw HTML code using Superagent prior to 301 redirects?

Check out this website , but when you open it, you'll be redirected to If I use curl, I can retrieve the html code of : <html> <head><title>301 Moved Permanently</title></head> <body bgcolor="white"> <center> ...