Charge ch = Charge.retrieve(chargeId); ch.capture(); transaction.setPaymentType(PaymentType.CREDITCARD); transaction.getTransactionDetails().put("TRANSACTIONID", capturableTransaction.getTransactionDetails().get("TRANSACTIONID")); transaction.getTransactionDetails().put("TRNAPPROVED", ch.getStatus()); transaction.getTransactionDetails().put("TRNORDERNUMBER", ch.getId()); transaction.getTransactionDetails().put("MESSAGETEXT", null);
Charge ch = Charge.create(chargeParams); transaction.setPaymentType(PaymentType.CREDITCARD); transaction.getTransactionDetails().put("TRANSACTIONID", token); transaction.getTransactionDetails().put("TRNAPPROVED", ch.getStatus()); transaction.getTransactionDetails().put("TRNORDERNUMBER", ch.getId()); transaction.getTransactionDetails().put("MESSAGETEXT", null);
Charge ch = Charge.retrieve(trnID); Refund re = ch.getRefunds().create(params);
public void setDestinationPaymentObject(Charge destinationPayment) { this.destinationPayment = new ExpandableField<>(destinationPayment.getId(), destinationPayment); } // </editor-fold>
@Test public void testDeserialize() throws Exception { final String data = getFixture("/v1/charges/ch_123"); final Charge charge = ApiResource.GSON.fromJson(data, Charge.class); assertNotNull(charge); assertNotNull(charge.getId()); assertEquals("charge", charge.getObject()); assertNull(charge.getApplicationObject()); assertNull(charge.getApplicationFeeObject()); assertNull(charge.getBalanceTransactionObject()); assertNull(charge.getCustomerObject()); assertNull(charge.getDestinationObject()); assertNull(charge.getDisputeObject()); assertNull(charge.getInvoiceObject()); assertNull(charge.getOnBehalfOfObject()); assertNull(charge.getOrderObject()); assertNull(charge.getReviewObject()); assertNull(charge.getSourceTransferObject()); assertNull(charge.getTransferObject()); }
StripePaymentActivity.this, "Card Charged : " + charge.getCreated() + "\nPaid : " + charge.getPaid(), Toast.LENGTH_LONG).show(); }; Charge charge1 = Charge.create(chargeParams1); com.stripe.Stripe.apiKey = "sk_your key"; Charge ch2 = Charge.retrieve(charge1.getId()); // Use ch2.capture(); com.stripe.Stripe.apiKey = "sk_your key";
/** * Capture a charge. */ public Charge capture(Map<String, Object> params, RequestOptions options) throws StripeException { return request(RequestMethod.POST, String.format("%s/capture", instanceUrl(Charge.class, this.getId())), params, Charge.class, options); } // </editor-fold>
@Override public CaptureResult capture(AuthorizationResult authorizationResult) { String id = authorizationResult.getProviderUniqueId(); try { authorizationResult.getProviderUniqueId(); Charge ch = Charge.retrieve(id, options); ch.capture(options); return new CaptureResult( providerId, TransactionResult.CommunicationResult.SUCCESS, null, null, null, id ); } catch(StripeException e) { ConvertedError converted = convertError(e); return new CaptureResult( providerId, converted.communicationResult, converted.providerErrorCode, converted.errorCode, converted.providerErrorMessage, id ); } }
/** * Retrieve a charge. */ public static Charge retrieve(String id, RequestOptions options) throws StripeException { return retrieve(id, null, options); }
@Test public void testUpdate() throws StripeException { final Charge charge = getChargeFixture(); final Map<String, Object> metadata = new HashMap<>(); metadata.put("foo", "bar"); final Map<String, Object> params = new HashMap<>(); params.put("metadata", metadata); final Charge updatedCharge = charge.update(params); assertNotNull(updatedCharge); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/charges/%s", charge.getId()), params ); }
/** * Capture a charge. */ public Charge capture(RequestOptions options) throws StripeException { return this.capture(null, options); }
@Test public void testMarkFaudulent() throws StripeException { final Charge charge = getChargeFixture(); final Charge fraudulentCharge = charge.markFraudulent(null); assertNotNull(fraudulentCharge); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/charges/%s", charge.getId()), ImmutableMap.of("fraud_details", (Object)ImmutableMap.of("user_report", (Object)"fraudulent")) ); }
@Test public void testMarkSafe() throws StripeException { final Charge charge = getChargeFixture(); final Charge safeCharge = charge.markSafe(null); assertNotNull(safeCharge); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/charges/%s", charge.getId()), ImmutableMap.of("fraud_details", (Object)ImmutableMap.of("user_report", (Object)"safe")) ); } }
/** * Create a charge. */ public static Charge create(Map<String, Object> params) throws StripeException { return create(params, (RequestOptions) null); }
/** * Update a charge. */ @Override public Charge update(Map<String, Object> params) throws StripeException { return update(params, (RequestOptions) null); }
/** * List all charges. */ public static ChargeCollection list(Map<String, Object> params) throws StripeException { return list(params, null); }
public void setSourceTransactionObject(Charge sourceTransaction) { this.sourceTransaction = new ExpandableField<>(sourceTransaction.getId(), sourceTransaction); } // </editor-fold>
StripePaymentActivity.this, "Card Charged : " + charge.getCreated() + "\nPaid : " + charge.getPaid(), Toast.LENGTH_LONG).show(); }; Charge charge1 = Charge.create(chargeParams1); com.stripe.Stripe.apiKey = "sk_your key"; Charge ch2 = Charge.retrieve(charge1.getId()); // Use ch2.capture(); com.stripe.Stripe.apiKey = "sk_your key";
/** * Refund the charge. * * @deprecated Prefer using the {@link Refund#create(Map, RequestOptions)} method instead. */ @Deprecated public Charge refund(Map<String, Object> params, RequestOptions options) throws StripeException { return request(RequestMethod.POST, String.format("%s/refund", instanceUrl(Charge.class, this.getId())), params, Charge.class, options); } // </editor-fold>