0

Stage a PayPal payment

by
Published Oct 17, 2025

__Deprecated__ This operation is disabled and no longer accessible. PayPal can be designated as a Payment Method for automated payments using the Cloud Manager. See [Manage Payment Methods](https://www.linode.com/docs/products/platform/billing/guides/payment-methods/). > --- - __OAuth scopes__. ``` account:read_write ``` [Learn more...](https://techdocs.akamai.com/linode-api/reference/get-started#oauth)

Script linode Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Linode = {
3
  token: string;
4
};
5
/**
6
 * Stage a PayPal payment
7
 * __Deprecated__ This operation is disabled and no longer accessible. PayPal can be designated as a Payment Method for automated payments using the Cloud Manager. See [Manage Payment Methods](https://www.linode.com/docs/products/platform/billing/guides/payment-methods/).
8

9

10
>
11

12
---
13

14

15
- __OAuth scopes__.
16

17
    ```
18
    account:read_write
19
    ```
20

21
    [Learn more...](https://techdocs.akamai.com/linode-api/reference/get-started#oauth)
22
 */
23
export async function main(
24
  auth: Linode,
25
  apiVersion: "v4" | "v4beta",
26
  body: { cancel_url: string; redirect_url: string; usd: string },
27
) {
28
  const url = new URL(
29
    `https://api.linode.com/${apiVersion}/account/payments/paypal`,
30
  );
31

32
  const response = await fetch(url, {
33
    method: "POST",
34
    headers: {
35
      "Content-Type": "application/json",
36
      Authorization: "Bearer " + auth.token,
37
    },
38
    body: JSON.stringify(body),
39
  });
40
  if (!response.ok) {
41
    const text = await response.text();
42
    throw new Error(`${response.status} ${text}`);
43
  }
44
  return await response.json();
45
}
46