Edits history of script submission #16916 for ' Execute a PayPal payment (linode)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Linode = {
      token: string;
    };
    /**
     * Execute a PayPal payment
     * __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)
     */
    export async function main(
      auth: Linode,
      apiVersion: "v4" | "v4beta",
      body: { payer_id: string; payment_id: string },
    ) {
      const url = new URL(
        `https://api.linode.com/${apiVersion}/account/payments/paypal/execute`,
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.token,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago