Pass amount in Payment then its shows incorrect in payment fragment

Hi,
When i set amount in paymnet instance then its shows me an incorrect amount in payment dialog.
like if i pass 93 then its shows $0.93 amount in payment fragment.

Also when i passing my OrderItem to that next screen that that are not shown on second terminal

So what i have to do?

Hi there,

The amount needs to be in cents, so 93 would translate to $0.93. Please refer to https://github.com/poynt/PoyntSamples/blob/master/app/src/main/java/co/poynt/samples/SampleActivity.java#L87.

I am not sure what you issue you are having with OrderItem. Can you provide some more details or post the code snippet?

Hi Dennis,
For that second terminal problem,
I am done my code after IPoyntSecondScreenService is connected.
and i add my cart’s products, in List.
I do same code which is done in that git sample,onClick of displayItems button.
that code is perform after IPoyntSecondScreenService is connected and i also check that,
List instance is not blank while do that operations.

Before its shows properly but now in that second terminal i cant see my products.

Can you make sure make your build.gradle has the following dependencies:

// Poynt Dependencies
compile ‘co.poynt.api:android-api-model:1.2.32@jar’
compile ‘co.poynt.android.sdk:poynt-sdk:1.2.8@aar’

Yes,
that dependency is already added but is it visible to second terminal a after i launch my payment fragment.
Because i do my code as follows.

private ServiceConnection mSecondScreenConnection = new ServiceConnection() {

    public void onServiceConnected(ComponentName className, IBinder service) {
        Log.d(TAG, "IPoyntSecondScreenService is now connected");
       
        mSecondScreenService = IPoyntSecondScreenService.Stub
                .asInterface(service);
        loadDataToSecondScreen();
    }

    public void onServiceDisconnected(ComponentName className) {
        Log.d(TAG,
                "IPoyntSecondScreenService has unexpectedly disconnected");
        mSecondScreenService = null;
    }
};

public void loadDataToSecondScreen() {
try {
if (mSecondScreenService != null) {
BigDecimal total = new BigDecimal(0);
for (OrderItem item : items) {
BigDecimal price = new BigDecimal(item
.getUnitPrice());
price.setScale(2, RoundingMode.HALF_UP);
price = price.multiply(new BigDecimal(item
.getQuantity()));
total = total.add(price);
}
mSecondScreenService.showItem(items, total.longValue(),
“USD”);
}
} catch (RemoteException e) {
e.printStackTrace();
}
}

Hi Dennis,

I am following https://github.com/poynt/PoyntSamples/blob/master/app/src/main/java/co/poynt/samples/SampleActivity.java#L87 but still payment fragment is showing wrong amount there.

` private void launchPoyntPayment(Order order) {
String currencyCode = NumberFormat.getCurrencyInstance().getCurrency().getCurrencyCode();

    Payment payment = new Payment();
    String referenceId = UUID.randomUUID().toString();
    payment.setReferenceId(referenceId);
    payment.setAmount(order.getAmounts().getSubTotal().longValue());
    payment.setCurrency(currencyCode);
    Log.e("Amount",""+order.getAmounts().getSubTotal().longValue());
    // start Payment activity for result
    try {
        Intent collectPaymentIntent = new Intent(Intents.ACTION_COLLECT_PAYMENT);
        collectPaymentIntent.putExtra(Intents.INTENT_EXTRAS_PAYMENT, payment);
        startActivityForResult(collectPaymentIntent, COLLECT_PAYMENT_REQUEST);
    } catch (ActivityNotFoundException ex) {
        Log.e(TAG, "Poynt Payment Activity not found - did you install PoyntServices?", ex);
    }
}

Please let me know what changes I need to make here.

Best
Sandeep`

what amount are you passing and what amount is it showing?

I am passing $500 and it is showing $5 to me in Payment.

orderItem.setUnitPrice(catalogItemWithProduct.getProduct().getPrice().getAmount().longValue());

I am setting unit price like this.

The amount is in cents, so you would need to pass “50000”. However, the test gateway we connect to will decline transactions above $130.00.

Thanks dennis, I will make modification in my app. I am again facing the invalid token issue like last time. Last time , it was fixed automatically. I assume there is some issue going at poynt side.