Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@onramper/moonpay-adapter
Advanced tools
Readme
It works like a fetch mock:
import processMoonpayStep, { moonpayUrlRegex } from '@onramper/moonpay-adapter'
const method = step.type === 'file' ? 'PUT' : 'POST'
const body = step.type === 'file' ? data as File : JSON.stringify(data)
const nextStepType = step.url.split('/')[5]
let nextStep: FetchResponse;
if (isMoonpayStep(step.url) && nextStepType !== "iframe") {
nextStep = await processMoonpayStep(step.url, { method, headers, body });
} else {
nextStep = await fetch(step.url, { method, headers, body })
}
return processResponse(nextStep)
Due to Moonpay's cookie policy all operations must be performed from the same origin, meaning that the sandbox that handles credit card payments requires a special workaround that doesn't fit our API response model. Namely, the response from the sandbox must be further processed by client-side code before the next step is provided, so the following code is needed:
import { finishCCTransaction, baseCreditCardSandboxUrl } from '@onramper/moonpay-adapter'
const receiveMessage = async (event: MessageEvent) => {
if (event.origin !== baseCreditCardSandboxUrl)
return;
if (event.data.type) {
replaceScreen(event.data)
} else if (event.data.transactionId) {
const returnedNextStep = await finishCCTransaction(event.data.transactionId, event.data.ccTokenId);
replaceScreen(returnedNextStep)
} else {
setError('Unknown error. Please, contact help@onramper.com and provide the following info: ' + nextStep.url)
}
}
window.addEventListener("message", receiveMessage);
FAQs
It works like a fetch mock: ```ts import processMoonpayStep, { moonpayUrlRegex } from '@onramper/moonpay-adapter'
The npm package @onramper/moonpay-adapter receives a total of 127 weekly downloads. As such, @onramper/moonpay-adapter popularity was classified as not popular.
We found that @onramper/moonpay-adapter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.