Closed merfi1 closed 1 year ago
سلام میشه بگید از چه نسخهای استفاده میکنید؟
سلام بله نسخه zarinpalSdkVersion = "0.5.3"
اینا رو اضافه کردم implementation 'com.zarinpal:payment-provider:'+ project.ext.zarinpalSdkVersion implementation 'com.zarinpal:mpg:' +project.ext.zarinpalSdkVersion
توی منیفست از این کد برای برگشت اطلاعات
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="retuern" android:host="zarinpalpayment"/>
اینم کل متد payment
private void payment(long price){
BillingClientStateListener listener = new BillingClientStateListener() {
@Override
public void onClientSetupFinished(@NotNull ClientState state) {
//Observing client states
}
@Override
public void onClientServiceDisconnected() {
Log.v("TAG_INAPP","Billing client Disconnected");
//When Service disconnect
}
};
ZarinPalBillingClient client = ZarinPalBillingClient.newBuilder(this)
.enableShowInvoice()
.setListener(listener)
.setNightMode(AppCompatDelegate.MODE_NIGHT_NO)
.build();
String merchantId = "------------------------------------";
long amount = price;
String description = "حمایت و خرید نرم افزار حسابداری آلفا";
String callback = "retuern://zarinpalpayment";
Purchase purchase = Purchase.newBuilder().asPaymentRequest(merchantId, amount, callback, description).build();
client.launchBillingFlow(purchase, task -> {
if (task.isSuccess()) {
Receipt receipt = task.getSuccess();
Log.v("ZP_RECEIPT", receipt.getTransactionID());
Toast.makeText(this, ""+receipt.getTransactionID(), Toast.LENGTH_SHORT).show();
txtRes.setText(receipt.getTransactionID());
//here you can send receipt data to your server
//sentToServer(receipt)
} else {
task.getFailure().printStackTrace();
Toast.makeText(this, "kkkkkkkkk", Toast.LENGTH_SHORT).show();
}
});
}
چی شد؟؟
سلام من همه این کارا رو انجام دادم خرید هم انجام میشه ولی اطلاعات خرید به داخل اپ برگشت داده نمیشه باید چیکار کنم لطفا راهنمایی کنید ممنون