@sergdudko/stripe-js
Version:
Additional methods for working with stripe-js
26 lines • 956 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCustomer = void 0;
const handlers_1 = require("../utils/handlers");
const constants_1 = require("../utils/constants");
/**
* Get customer data
*
* @param customerId - customer id (see: https://stripe.com/docs/api/customers/object#customer_object-id)
* @param ephemeralKey - customer ephemeral key
* @returns
*/
const getCustomer = async function (customerId, ephemeralKey) {
const stripeApiKey = this._apiKey;
if (typeof stripeApiKey !== "string")
throw new Error("Initialization failed.");
// make request
return fetch(`${constants_1.stripeApiUrl}/customers/${customerId}`, {
headers: {
Authorization: `Bearer ${ephemeralKey}`,
"Stripe-Version": constants_1.stripeApiVersion,
},
}).then(handlers_1.responseHandler);
};
exports.getCustomer = getCustomer;
//# sourceMappingURL=getCustomer.js.map