Skip to main content
To implement the payment flow of Propaga, you need to import the PropagaPaymentComponent using the global hook too.
import { usePropaga } from '@propaga/react-native-sdk';
const MyAwesomeCheckout = () => {
 const { PropagaPaymentComponent } = usePropaga();
 return ( ... );
}
Now you can implement it in this way.
<PropagaPaymentComponent
  transaction={{
    cornerStoreId: '1234567890',
    products: [{ 
      externalSKU: '123', 
      name: 'ProductName', 
      quantity: 1 
    }],
    totalAmount: 2000,
    wholesalerTransactionId: 'TRAN-3245',
  }}
  user={{
    phoneNumber: '52123567890',
    firstName: 'Jon',
    lastNames: 'Snow',
    latitude: '19.4362086',
    longitude: '-99.1572047',
  }}
  config={{
    token: '...',
  }}
  onSuccessTransaction={(response) => console.log(response)}
  onErrorTransaction={(error) => console.log(error)}
/>
If the payment flow is completed, the callback onSuccessTransaction will be executed with the following response format:
{
  transactionId: 'e83bd5ca-7742-42e5-97c2-b7a0fbaa68cf',
  totalAmountWithInterest: 2000,
  cornerStoreId: '6f29a76a-41c4-4c9f-b13b-709b936f4eeb',
  paymentDate: '2019-01-01',
}
However, if an error occurs, the callback onErrorTransaction will be called with this value:
{
  errorCode: '',
  errorMessage:'',
}