com.stripe.param.InvoicePayParams Maven / Gradle / Ivy
// Generated by com.stripe.generator.entity.SdkBuilder
package com.stripe.param;
import com.google.gson.annotations.SerializedName;
import com.stripe.net.ApiRequestParams;
import java.util.ArrayList;
import java.util.List;
public class InvoicePayParams extends ApiRequestParams {
/** Specifies which fields in the response should be expanded. */
@SerializedName("expand")
List expand;
/**
* In cases where the source used to pay the invoice has insufficient funds, passing
* `forgive=true` controls whether a charge should be attempted for the full amount available on
* the source, up to the amount to fully pay the invoice. This effectively forgives the difference
* between the amount available on the source and the amount due.
*
* Passing `forgive=false` will fail the charge if the source hasn't been pre-funded with the
* right amount. An example for this case is with ACH Credit Transfers and wires: if the amount
* wired is less than the amount due by a small amount, you might want to forgive the difference.
*/
@SerializedName("forgive")
Boolean forgive;
/**
* Boolean representing whether an invoice is paid outside of Stripe. This will result in no
* charge being made.
*/
@SerializedName("paid_out_of_band")
Boolean paidOutOfBand;
/**
* A PaymentMethod to be charged. The PaymentMethod must be the ID of a PaymentMethod belonging to
* the customer associated with the invoice being paid.
*/
@SerializedName("payment_method")
String paymentMethod;
/**
* A payment source to be charged. The source must be the ID of a source belonging to the customer
* associated with the invoice being paid.
*/
@SerializedName("source")
String source;
private InvoicePayParams(
List expand,
Boolean forgive,
Boolean paidOutOfBand,
String paymentMethod,
String source) {
this.expand = expand;
this.forgive = forgive;
this.paidOutOfBand = paidOutOfBand;
this.paymentMethod = paymentMethod;
this.source = source;
}
public static Builder builder() {
return new com.stripe.param.InvoicePayParams.Builder();
}
public static class Builder {
private List expand;
private Boolean forgive;
private Boolean paidOutOfBand;
private String paymentMethod;
private String source;
/** Finalize and obtain parameter instance from this builder. */
public InvoicePayParams build() {
return new InvoicePayParams(
this.expand, this.forgive, this.paidOutOfBand, this.paymentMethod, this.source);
}
/**
* Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* InvoicePayParams#expand} for the field documentation.
*/
public Builder addExpand(String element) {
if (this.expand == null) {
this.expand = new ArrayList<>();
}
this.expand.add(element);
return this;
}
/**
* Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* InvoicePayParams#expand} for the field documentation.
*/
public Builder addAllExpand(List elements) {
if (this.expand == null) {
this.expand = new ArrayList<>();
}
this.expand.addAll(elements);
return this;
}
/**
* In cases where the source used to pay the invoice has insufficient funds, passing
* `forgive=true` controls whether a charge should be attempted for the full amount available on
* the source, up to the amount to fully pay the invoice. This effectively forgives the
* difference between the amount available on the source and the amount due.
*
* Passing `forgive=false` will fail the charge if the source hasn't been pre-funded with the
* right amount. An example for this case is with ACH Credit Transfers and wires: if the amount
* wired is less than the amount due by a small amount, you might want to forgive the
* difference.
*/
public Builder setForgive(Boolean forgive) {
this.forgive = forgive;
return this;
}
/**
* Boolean representing whether an invoice is paid outside of Stripe. This will result in no
* charge being made.
*/
public Builder setPaidOutOfBand(Boolean paidOutOfBand) {
this.paidOutOfBand = paidOutOfBand;
return this;
}
/**
* A PaymentMethod to be charged. The PaymentMethod must be the ID of a PaymentMethod belonging
* to the customer associated with the invoice being paid.
*/
public Builder setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
return this;
}
/**
* A payment source to be charged. The source must be the ID of a source belonging to the
* customer associated with the invoice being paid.
*/
public Builder setSource(String source) {
this.source = source;
return this;
}
}
}