UNPKG

@hyperse/paypal-node-sdk

Version:

NodeJS SDK for PayPal Checkout APIs

31 lines (30 loc) 1.06 kB
import {} from './AccessTokenRequest.js'; import { HttpRequestBase } from './HttpRequestBase.js'; import {} from './PayPalEnvironment.js'; /** * An OAuth2 refresh token request, granted from user consent. * * Documentation * * @see {@link https://github.com/hyperse-io/paypal-node-sdk/tree/main/src/core/RefreshTokenRequest.ts} */ export class RefreshTokenRequest extends HttpRequestBase { /** * @param {PayPalEnvironment} environment - The environment for this request (sandbox or live) * @param {string} code - The authorization code provided at the end of the user consent OAuth flow. */ constructor(environment, code) { super(); const body = { grant_type: 'authorization_code', code: code, }; this.headers = { 'Content-Type': 'application/x-www-form-urlencoded', Authorization: environment.authorizationString(), }; this.path = '/v1/identity/openidconnect/tokenservice'; this.body = body; this.verb = 'POST'; } }