/
AccountSession.java
105 lines (95 loc) · 3.84 KB
/
AccountSession.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// File generated from our OpenAPI spec
package com.stripe.model;
import com.google.gson.annotations.SerializedName;
import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.net.ApiResource;
import com.stripe.net.RequestOptions;
import com.stripe.param.AccountSessionCreateParams;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* An AccountSession allows a Connect platform to grant access to a connected account in Connect
* Embedded UIs.
*
* <p>We recommend that you create an AccountSession each time you need to display an embedded UI to
* your user. Do not save AccountSessions to your database as they expire relatively quickly, and
* cannot be used more than once.
*
* <p>Related guide: <a href="https://stripe.com/docs/connect/get-started-connect-elements">Connect
* Embedded UIs</a>.
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class AccountSession extends ApiResource {
/** The ID of the account the AccountSession was created for. */
@SerializedName("account")
String account;
/**
* The client secret of this AccountSession. Used on the client to set up secure access to the
* given {@code account}.
*
* <p>The client secret can be used to provide access to {@code account} from your frontend. It
* should not be stored, logged, or exposed to anyone other than the connected account. Make sure
* that you have TLS enabled on any page that includes the client secret.
*
* <p>Refer to our docs to <a
* href="https://stripe.com/docs/connect/get-started-connect-elements">setup Connect Embedded
* UIs</a> and learn about how {@code client_secret} should be handled.
*/
@SerializedName("client_secret")
String clientSecret;
/** The timestamp at which this AccountSession will expire. */
@SerializedName("expires_at")
Long expiresAt;
/**
* Has the value {@code true} if the object exists in live mode or the value {@code false} if the
* object exists in test mode.
*/
@SerializedName("livemode")
Boolean livemode;
/**
* String representing the object's type. Objects of the same type share the same value.
*
* <p>Equal to {@code account_session}.
*/
@SerializedName("object")
String object;
/**
* Creates a AccountSession object that includes a single-use token that the platform can use on
* their front-end to grant client-side API access.
*/
public static AccountSession create(Map<String, Object> params) throws StripeException {
return create(params, (RequestOptions) null);
}
/**
* Creates a AccountSession object that includes a single-use token that the platform can use on
* their front-end to grant client-side API access.
*/
public static AccountSession create(Map<String, Object> params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/account_sessions");
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, AccountSession.class, options);
}
/**
* Creates a AccountSession object that includes a single-use token that the platform can use on
* their front-end to grant client-side API access.
*/
public static AccountSession create(AccountSessionCreateParams params) throws StripeException {
return create(params, (RequestOptions) null);
}
/**
* Creates a AccountSession object that includes a single-use token that the platform can use on
* their front-end to grant client-side API access.
*/
public static AccountSession create(AccountSessionCreateParams params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/account_sessions");
return ApiResource.request(
ApiResource.RequestMethod.POST, url, params, AccountSession.class, options);
}
}