Ir para o conteúdo

Integration with Payment Application via Broadcast


Unlike other integrations, in broadcast integration, other applications can notify you that a payment or chargeback has been integrated. This information is sent by the submissions application/via Broadcasts which can be received by any applications you are interested in knowing the occurrence of payments or chargebacks.

Actions

Action Extra
Intents.action.ACTION_AFTER_PAYMENT (br.com.phoebus.android.payments.AFTER_PAYMENT_FINISHED) Intents.extra.EXTRA_PAYMENT_RETURN: Payment (vide startPaymentV2() or class documentation.)
Intents.action.ACTION_AFTER_REVERSAL (br.com.phoebus.android.payments.AFTER_PAYMENT_REVERSAL_FINISHED) Intents.extra.EXTRA_PAYMENT_RETURN: ReversePayment (vide reversePaymentV2() or class documentation.)
Intents.action.ACTION_AFTER_SETTLEMENT (br.com.phoebus.android.payments.ACTION_AFTER_SETTLEMENT) Intents.extra.EXTRA_SETTLEMENT_RETURN: SettlementBroadcastResponse, EXTRA_SETTLEMENT_RETURN_V2 : SettlementBroadcastResponseV2 (ou vide documentação da classe.)
Intents.action.ACTION_SDK_IDLE_NOTIFICATION (br.com.phoebus.android.payments.SDK_IDLE_NOTIFICATION) When a payment (see startPaymentV2() is made with all print parameters as false, the terminal waits for a broadcast from the integrated application to perform initialization after payment, if necessary. This process is also used to signal application updates.
## Example
public class MyBroadcastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {

        if (intent.getAction().equals(Intents.action.ACTION_AFTER_PAYMENT)) {
            Payment payment = DataUtils.fromBundle(Payment.class, intent.getExtras(), Intents.extra.EXTRA_PAYMENT_RETURN);

            // Do something!

        } else if (intent.getAction().equals(Intents.action.ACTION_AFTER_REVERSAL)) {
            ReversePayment reversePayment = DataUtils.fromBundle(ReversePayment.class, intent.getExtras(), Intents.extra.EXTRA_PAYMENT_RETURN);

            // Do something!

        } else if (intent.getAction().equals(Intents.action.ACTION_AFTER_SETTLEMENT)) {
            SettlementBroadcastResponse settlementBroadcastResponse = DataUtils.fromBundle(SettlementBroadcastResponse.class, intent.getExtras(), Intents.extra.EXTRA_SETTLEMENT_RETURN);
            SettlementBroadcastResponseV2 settlementBroadcastResponseV2 = SettlementBroadcastResponseV2.fromBundle(intent.getBundleExtra(Intents.extra.EXTRA_SETTLEMENT_RETURN_V2));

            // Do something!

        } else if(intent.getAction().equals(Intents.action.ACTION_SDK_IDLE_NOTIFICATION)){
            // Do something!
        }


    }

}