@daimo/pay
Version:
Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.
24 lines (21 loc) • 885 B
JavaScript
import { writeDaimoPayOrderID } from '@daimo/pay-common';
import { useDaimoPay } from './useDaimoPay.js';
/** Returns the current payment, or undefined if there is none.
*
* Status values:
* - `payment_unpaid` - the user has not paid yet
* - `payment_started` - the user has paid & payment is in progress. This status
* typically lasts a few seconds.
* - `payment_completed` - the final call or transfer succeeded
* - `payment_bounced` - the final call or transfer reverted. Funds were sent
* to the payment's configured refund address on the destination chain.
*/
function useDaimoPayStatus() {
const { order } = useDaimoPay();
if (order == null)
return undefined;
const paymentId = writeDaimoPayOrderID(order.id);
return { paymentId, status: order.intentStatus };
}
export { useDaimoPayStatus };
//# sourceMappingURL=useDaimoPayStatus.js.map