npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@paywallex/react-native

v1.0.0

Published

Kit officiel Paywallex pour React Native et Expo : paiement et abonnement par le compte Paywallex ou Mobile Money, retour dans l'app, confirmation serveur.

Readme

@paywallex/react-native

Kit officiel Paywallex pour React Native et Expo. Il ouvre la page Paywallex dans la session navigateur du système (jamais une WebView). La personne paie avec son compte Paywallex en un geste ou avec Mobile Money, puis revient dans votre app par son schéma (monapp://…).

Le kit couvre le paiement, l'abonnement, le retour dans l'app et la confirmation auprès de Paywallex.

Avant de livrer une commande ou d'ouvrir un accès, confirmez toujours depuis votre serveur (webhook ou API /v1). Le retour dans l'app seul ne prouve rien.

Installation

Installez le kit et le navigateur système d'Expo :

npx expo install @paywallex/react-native expo-web-browser

Sans Expo, passez votre propre fonction openAuthSession au kit (par exemple openAuth de react-native-inappbrowser-reborn).

Avant de commencer

Dans le Labs, rubrique Connecter une app : choisissez React Native et déclarez votre adresse de retour, par exemple monapp://paiement. Le Labs vous donne la clé publique de l'app (pxa_test_… en bac à sable, pxa_live_… en production) et l'adresse de l'API.

Déclarez aussi le schéma dans app.json :

{ "expo": { "scheme": "monapp" } }

Encaisser un paiement

Le montant est en unités entières de la devise du compte ("5000" pour 5 000 F). La référence est votre numéro de commande, unique.

Créez le client, puis lancez le paiement :

import { Paywallex } from "@paywallex/react-native";

const paywallex = new Paywallex({
  appKey: "pxa_test_…",
  baseUrl: "https://api.paywallx.xyz",
  returnUrl: "monapp://paiement",
});

const result = await paywallex.pay({ amount: "5000", reference: "CMD-1042", title: "Commande 1042" });
if (result.outcome === "paid") {
  // Afficher « Merci ». Votre serveur livre après le webhook payment.succeeded.
}

outcome vaut paid, pending (Mobile Money pas encore confirmé : réessayez avec paywallex.status("CMD-1042")), failed, expired ou cancelled.

Abonner une personne

Un abonnement se crée toujours depuis votre serveur, avec votre clé secrète. La personne l'accepte ensuite dans Paywallex.

Sur votre serveur, créez le lien avec le schéma de l'app en retour :

const link = await paywallexServer.subscriptions.create({
  plan: "…",
  customer_reference: "client-77",
  success_url: "monapp://abonnement",
  cancel_url: "monapp://abonnement",
});
// renvoyez link.subscribe_url à l'app

Dans l'app, ouvrez le lien :

const r = await paywallex.subscribe(subscribeUrl);
if (r.outcome === "returned") {
  // r.subscriptionId : votre serveur vérifie GET /v1/subscriptions/{id} avant d'ouvrir l'accès
}

Pour « Gérer mon abonnement », votre serveur crée le lien avec POST /v1/subscriptions/{id}/manage_link, puis l'app l'ouvre avec paywallex.manageSubscription(manageUrl).

Les erreurs

Chaque erreur est une PaywallexError avec un code stable : invalid_return_url, invalid_url, invalid_response, ou le code renvoyé par Paywallex. Testez le code, jamais le message.

Licence

MIT.